Solved

Sending/Receiving XML documents via Web Pages

Posted on 2001-08-13
7
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 5

Accepted Solution

by:
mattyk earned 50 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

632 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