Receive and process a XML post

M

Marja de Vroed

I'm trying to build a page which is able to receive and process an XML message that is posted to it by some other page.
The sending page is working fine, but I don't now how to 'pick up' the sent message in the receiving page.

Right now I have the following code:

' Load the posted XML document.
Set oXML = Server.Createobject("MSXML2.DOMDocument.4.0")
oXML.async = False
oXML.setProperty "ServerHTTPRequest", True
oXML.load(Request)
oXML.save Server.MapPath("/uploads/docs/Xml/received.xml")
Set oXML = Nothing

I'm trying to write the received XML message to disk, because then I have some evidence that the page did execute. However, no file gets written (the output directory does have write access).
Since the 'listening' page will never be loaded by a browser, and thus has no "user interface", I don't know how to test the above code other than by trying to write output to some file on disk.

What am I missing?
 
A

Anthony Jones

The problem may be that the file doesn't parse properly.

Using MSXML2.DOMDocument.4.0 as the ProgID will cause MSXML to be fair
strict about how the file is parsed. (E.g., blank lines preceeding an <?xml
declaration causes the file not parse).

You will need to examine the parseError property of the DOM to see why the
input is being rejected.

BTW, ServerHTTPRequest property is only necessary of you are going to give
the load method a URL.


Anthony.
 
M

Marja de Vroed

Never mind, issue solved. The example code I posted was correct after all.

There was some more code on in the receiving ASP file that was causing a 500 error.
Therefore the code I posted here previously wasn't even executed.

I managed to find this by examining the response status text in the sending page after the send
 
M

Marja de Vroed

Hi Anthony,

Thank you for your reply.

However it turned out that the code I posted here was working fine.
Something else on the receiving page was causing a problem. (See my other post)

Regards, Marja
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top