Solved

Sending/Receiving XML documents via Web Pages

Posted on 2001-08-13
7
192 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 50 total points
Comment Utility
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:wbradney
Comment Utility
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
Comment Utility

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:pyromyst
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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.
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. 
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now