473,778 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forward XML request

Hi group !

I am trying to write an ASP page that would forward an XML request
to a remote server, and then write the response to the client (a
kind of proxy, if you like).

I am sending the query to this ASP via a VBA (access2k) procedure,
which basically looks like :

Dim oXMLHTTP As New MSXML2.XMLHTTP4 0
Const strURL As String = "http://myserver/myasppage.asp"
Dim strResponse As String

oXMLHTTP.Open "POST", strURL, False
oXMLHTTP.Send "<?xml version=""1.0"" encoding
=""iso-8859-1""?><xmlxml xml/>"
strResponse = oXMLHTTP.respon seXML.xml

Now, the problem I have is to retrieve this XML !
In the ASP, I tried :

strQuery = Request.BinaryR ead(Request.Tot alBytes)

This kind of works but I retrieve an array of bytes, and this
really not easy to convert to xml to be sent again.

I tried with a form, but it didn't work at all :
oXMLHTTP.SetReq uestHeader "Content-Type",
"applicatio n/x-www-form-urlencoded"
oXMLHTTP.Send "queryxml=" & strQueryXML

I did not retrieve anything in the ASP with
Request.Form("q ueryxml")...

Does anyone know of an easy solution for this ?

Thanks a lot !
--
Arnaud Lesauvage
Jun 13 '06 #1
2 4954

"Bingo" <Bi***@discussi ons.microsoft.c om> wrote in message
news:u4******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi group !

I am trying to write an ASP page that would forward an XML request
to a remote server, and then write the response to the client (a
kind of proxy, if you like).

I am sending the query to this ASP via a VBA (access2k) procedure,
which basically looks like :

Dim oXMLHTTP As New MSXML2.XMLHTTP4 0
Const strURL As String = "http://myserver/myasppage.asp"
Dim strResponse As String

oXMLHTTP.Open "POST", strURL, False
oXMLHTTP.Send "<?xml version=""1.0"" encoding
=""iso-8859-1""?><xmlxml xml/>"
You're passing send a Unicode string (which it will encode to UTF-8) but
specifying an ISO-8859-1 encoding don't do that else things can get decoded
incorrectly. You're probably better off not sending the XML declare at all.

You're also sending XML as a string. You're better of building your XML in
a DOM and passing the DOM to the send method (xmlhttp knows what to do with
it) . BTW using DOM will cause the encoding to follow the encoding in the
xml declare if you add one to the DOM and will add the appropriate text/xml
content type header.

strResponse = oXMLHTTP.respon seXML.xml

If it's returning XML and the xml is of use why are you retrieving the XML
string.


Now, the problem I have is to retrieve this XML !
In the ASP, I tried :

strQuery = Request.BinaryR ead(Request.Tot alBytes)

This kind of works but I retrieve an array of bytes, and this
really not easy to convert to xml to be sent again.

I tried with a form, but it didn't work at all :
oXMLHTTP.SetReq uestHeader "Content-Type",
"applicatio n/x-www-form-urlencoded"
oXMLHTTP.Send "queryxml=" & strQueryXML

I did not retrieve anything in the ASP with
Request.Form("q ueryxml")...

Now you really are getting lost.

The big question is do you need to pre or post process this XML in this
'middle-man' ASP page?

I'll assume not :-

Dim oXMLHTTP: Set oXMLHTTP = Server.CreateOb ject("MSXML2.Se rverXMLHTTP.x.0 ")
'replace x with 3|4|6

oXMLHTTP.open(" POST", "otherURL", false)
oXMLHTTP.setReq uestHeader("Con tent-Type",
Request.ServerV ariables("CONTE NT-TYPE"))
oXMLHTTP.send Request ' Note .send can accept the Request object directly

'send the result back raw

Response.Status = oXMLHTTP.Status
Response.Conten tType = oXMLHTTP.getRes ponseHeader("Co ntent-Type")
Response.Binary Write oXMLHTTP.respon seBody

Does anyone know of an easy solution for this ?

Thanks a lot !
--
Arnaud Lesauvage


Jun 13 '06 #2
Hi Anthony, thanks a lot for your answer !

It is of great help !
I still have some problems, but I'll ty to solve them on my own now !

Anthony Jones a écrit :
"Bingo" <Bi***@discussi ons.microsoft.c om> wrote in message
news:u4******** ********@TK2MSF TNGP05.phx.gbl. ..
Hi group !

I am trying to write an ASP page that would forward an XML request
to a remote server, and then write the response to the client (a
kind of proxy, if you like).

I am sending the query to this ASP via a VBA (access2k) procedure,
which basically looks like :

Dim oXMLHTTP As New MSXML2.XMLHTTP4 0
Const strURL As String = "http://myserver/myasppage.asp"
Dim strResponse As String

oXMLHTTP.Open "POST", strURL, False
oXMLHTTP.Send "<?xml version=""1.0"" encoding
=""iso-8859-1""?><xmlxml xml/>"


You're passing send a Unicode string (which it will encode to UTF-8) but
specifying an ISO-8859-1 encoding don't do that else things can get decoded
incorrectly. You're probably better off not sending the XML declare at all.

You're also sending XML as a string. You're better of building your XML in
a DOM and passing the DOM to the send method (xmlhttp knows what to do with
it) . BTW using DOM will cause the encoding to follow the encoding in the
xml declare if you add one to the DOM and will add the appropriate text/xml
content type header.

strResponse = oXMLHTTP.respon seXML.xml


If it's returning XML and the xml is of use why are you retrieving the XML
string.


Now, the problem I have is to retrieve this XML !
In the ASP, I tried :

strQuery = Request.BinaryR ead(Request.Tot alBytes)

This kind of works but I retrieve an array of bytes, and this
really not easy to convert to xml to be sent again.

I tried with a form, but it didn't work at all :
oXMLHTTP.SetReq uestHeader "Content-Type",
"applicatio n/x-www-form-urlencoded"
oXMLHTTP.Send "queryxml=" & strQueryXML

I did not retrieve anything in the ASP with
Request.Form("q ueryxml")...


Now you really are getting lost.

The big question is do you need to pre or post process this XML in this
'middle-man' ASP page?

I'll assume not :-

Dim oXMLHTTP: Set oXMLHTTP = Server.CreateOb ject("MSXML2.Se rverXMLHTTP.x.0 ")
'replace x with 3|4|6

oXMLHTTP.open(" POST", "otherURL", false)
oXMLHTTP.setReq uestHeader("Con tent-Type",
Request.ServerV ariables("CONTE NT-TYPE"))
oXMLHTTP.send Request ' Note .send can accept the Request object directly

'send the result back raw

Response.Status = oXMLHTTP.Status
Response.Conten tType = oXMLHTTP.getRes ponseHeader("Co ntent-Type")
Response.Binary Write oXMLHTTP.respon seBody

Does anyone know of an easy solution for this ?

Thanks a lot !
--
Arnaud Lesauvage


Jun 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3740
by: Mark Watkins | last post by:
suppose I have the following: -----------BEGIN page1.asp---------- <form method="post" action="page2.asp"> <select name="someData" size="1" class="smallbutton"> <option value="1">Whatever</option> </select> 'and a submit button </form> ----------END page1.asp--------------
3
1980
by: jrefactors | last post by:
page0.asp->page1.jsp When the user click submit button in page0.asp, it will post the form request to page1.jsp. page0.asp and page1.jsp are in separate machines. In page1.jsp, based on the parameter interfaceName, it will forward to different jsp pages. However, we want to forward the request to a window with parameter like the following, without the menu bar and toolbar.
1
2388
by: jjouett | last post by:
I'm setting up a manually created WSDL file that defines the specifics of the required elements, default values, etc. instead of using the generated WSDL from the asmx?wsdl mechanism. Everything works with my web service, but I would like to have some mechanism that forwards any asmx?wsdl request to the manually created WSDL, to help guarantee that a client is using the WSDL with the restrictions. I can't turn off all documentation in the...
4
6280
by: John | last post by:
Hi everybody, for my web-application (it must currently work only under IE6) I have a servlet that intercepts user's HTTP GET requests for a typical search result page, which contains a paging mechanismus for navigating between the result pages (e.g. << 1 2 3 4 5 ... >). When the user clicks on this navigation, the JSP send a GET request to a servlet wich does some buisiness logic - in particular it logs (with log4j) how many times an...
0
1316
by: nielsena54 | last post by:
I am currently working on a client-server project using WCF. I have been using .NET for about 3 months now and have some questions about what it can do and how to do it. Before the question, here is the process that program follows: 1) A user logs in on a messenger-esque windows application. They are validated using a web service call to a central server. 2) Embedded in the application is a WCF service that exposes certain information....
1
4477
by: thallasridevi | last post by:
Hi All, I have page called page1.php with some hidden fields and i submitted the page to page2.php. I page2.php, i am able to get the values of hidden fields through $_REQUEST. And from this page 2 i need to forward the values of hidden fields to page3. Is any way to send the previous request directly to page3? or do i need to again write the values into hidden fields and get them in page3? I have a total of 70 hidden fields getting through...
5
7690
dmjpro
by: dmjpro | last post by:
Could anyone tell me what is difference between jsp:forward and RequestDispatcher.forward? These two codes behave differently ... <jsp:forward page="page_ref"/> and
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2865
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.