Clear questions and runnable code
get the best and fastest answer
Re: Re: Re: Re: Can't Post XML to SSL Siteby dpatrick (Scribe)
|on Oct 26, 2002 at 17:48 UTC ( #208254=note: print w/replies, xml )||Need Help??|
Okay, forget what I said about encoding. Here's what I know, but first I'll rephrase my question:
"Help. I need to post XML data (that is indeed XML as I'm using XML::AutoWriter to parse the vendor supplied DTD and generate valid XML data from it, which is then validated against the DTD before it even leaves XML::AutoWriter by XML::ValidWriter) to an SSL site for processing. There is no path info, just a hostname and port. The vendor's XML API documentation (which doesn't actually provide an API, just a definition of the XML elements which can be accepted) makes no mention of what content type to use for posting or anything. All they said is that they want the XML data (xml declaration or not, which I found out from testing) POSTED in a specific form variable, XMLSITE_XML for instance. Here is my code..."
What I found out after bouncing tests off of the server:
1. The server (application) doesn't read the content type. I can send text/xml, text/plain, text/arse, or not even specify content type.
2. Whatever encoding is applied by Net::SSLeay (which I think is none) is what the server wants
3. I really don't think there is any encoding done. Here's why: the "API" document had example code in Java. The Java submission was totally no frills, open a raw SSL socket, prepend "XMLSITE_XML=" to the generated XML data stored in a scalar, print the scalar to the SSL socket handle, receive the response back into a scalar, then close the handle.
Thus this is what I'm doing (I can also post the XML::AutoWriter stuff from a different module if anyone is interested):
And this works wonderfully so far.
For those interested, these are the reply headers from the server, which prompted me to (incorrectly) think I should send Content-type text/xml:
- I think scsh is cool.
Open Sourceror, Perlmonk
In Section Seekers of Perl Wisdom