Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sending/Receiving XML documents via Web Pages

Posted on 2001-08-13
7
Medium Priority
?
220 Views
Last Modified: 2012-05-04
Hi,

I have need of a system where I can request data from a web site in one country using my web site in another country.
This to and fro is to be in the form of XML documents using SSL (HTTPS).

When I need information from the web site I send it a request in the form of an XML document. The response I receice will be an XML document.
This initial request is to be performed using an ASP web page running off IIS.

I need to find a way of sending an XML request to this other site and then receiving an XML response.

How do I do this?
0
Comment
Question by:pyromyst
7 Comments
 
LVL 5

Accepted Solution

by:
mattyk earned 150 total points
ID: 6380449
Take a look at this article on using XMLHTTP or ServerXMLHTTP (both part of MSXML).

http://support.microsoft.com/support/kb/articles/Q290/5/91.asp

If your request is a simple ask for XML/get XML back then this should be sufficient.

cheers,
matty
0
 
LVL 6

Expert Comment

by:Wayne Bradney
ID: 6380739
pyromyst,

Something originally put together for Sun's JDC:

http://developer.java.sun.com/developer/qow/archive/84/index.html

Regards,
WMB
0
 

Expert Comment

by:macshiva
ID: 6381616

Try this!

asp1 sending datapacket:

Set objhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")

objhttp.setRequestHeader "Content-Type", "text/xml"

then use soap packet to send the xml content:

objhttp.Open "post", "http://******/***.asp", False

   strMethodPkg = "<SOAP:Envelope xmlns:SOAP=""urn:schemas-xmlsoap-org:soap.v1"">"
   strMethodPkg = strMethodPkg & "<SOAP:Header></SOAP:Header>"
   strMethodPkg = strMethodPkg & "<SOAP:Body><m:XMLPass xmlns:m=""urn:soapserver/soap:XMLModule"">"
   strMethodPkg = strMethodPkg & "<XMLString>" & <<this is xml>> & "</XMLString>"
   strMethodPkg = strMethodPkg & "</m:PassXML></SOAP:Body></SOAP:Envelope>"

objhttp.send strMethodPkg

''send pack to receiver end
''after this

strresult = objhttp.responseText
 
obx.loadXML strresult


Receiving End asp2:

Set objXMLDOM = Server.CreateObject("Microsoft.XMLDOM")
objXMLDOM.Load Request

''You validate according to your need
varXMLBack = objXMLDOM.SelectSingleNode("SOAP:Envelope/SOAP:Body/m:XMLPass/XMLString").Text

strResultXML = "<SOAP:Envelope xmlns:SOAP=""urn:schemas-xmlsoap-org:soap.v1""><SOAP:Header></SOAP:Header>"

strResultXML = strResultXML & "<SOAP:Body><m:XMLStrResponse xmlns:m=""urn:soapserver/soap:XMLModule"">"

strResultXML = strResultXML & "<XMLResult>" & varXMLBack & "</XMLResult></m:XMLStrResponse>"
strResultXML = strResultXML & "</SOAP:Body></SOAP:Envelope>"

Response.Write strResultXML

Best Regards,
Shiva
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:pyromyst
ID: 6409659
The ServerXMLHTTP object seems to be what I need, however all data that I send has its spaces stripped out.
I haven't been able to figure out why this happens but it does mean that all attempts at sending an XML string containing attributes fail.

If I were to send this XML:

<myXML>
  <Head Version="1.0">
    <Title>XML Stuff</Title>
  </Head>
</myXML>

I would get the XML below on the receiver page:

<myXML>
  <HeadVersion="1.0">
    <Title>XMLStuff</Title>
  </Head>
</myXML>

It seems that the send method of ServerXMLHTTP takes out spaces.

How can I prevent this?
0
 
LVL 1

Author Comment

by:pyromyst
ID: 6409720
The ServerXMLHTTP object seems to be what I need, however all data that I send has its spaces stripped out.
I haven't been able to figure out why this happens but it does mean that all attempts at sending an XML string containing attributes fail.

If I were to send this XML:

<myXML>
  <Head Version="1.0">
    <Title>XML Stuff</Title>
  </Head>
</myXML>

I would get the XML below on the receiver page:

<myXML>
  <HeadVersion="1.0">
    <Title>XMLStuff</Title>
  </Head>
</myXML>

It seems that the send method of ServerXMLHTTP takes out spaces.

How can I prevent this?
0
 
LVL 1

Author Comment

by:pyromyst
ID: 6478783
Hi again,

It has been a while since I posted my last comment but I have still not received an answer.

Using ServerXMLHTTP seems to be the solution, BUT only if it will send spaces. See my previous comment for details.
0
 
LVL 1

Author Comment

by:pyromyst
ID: 6479127
I have finally found a solution for keeping spaces when sending the data. The data is sent URLEncoded so I simply replaced all spaces with '%20' before sending.

It works fine now. :)

(NOTE: This would have been an excellent had I been told how to keep spaces, but not getting an answer wasted much of my valuable time.)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question