Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending/Receiving XML documents via Web Pages

Posted on 2001-08-13
7
Medium Priority
?
218 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 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
Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
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, …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

704 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