This VBScript posts an XML document to a webService:
Dim xmlhttp, oXML, sourceURL, WSURL, WSUserName, WSPassword, XMLResponse sourceURL = "C:\temp\myFileName.xml" WSURL = "https://mywebServiceURL" WSUserName = "myUserName" WSPassword = "myPassword" Set xmlhttp = CreateObject("Microsoft.XMLHTTP") Set oXML = CreateObject("Microsoft.XMLDOM") oXML.load(sourceURL) xmlhttp.open "POST", WSURL, false, WSUserName, WSPassword xmlhttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded; charset=UTF-8" xmlhttp.setRequestHeader "Content-length", Len(oXML.xml) xmlhttp.setRequestHeader "Connection", "close" xmlhttp.setRequestHeader "soapAction", "processRequest" xmlhttp.send(oXML.xml) writeLog "XML len = " & Len(oXML.xml) writeLog "readyState = " & xmlhttp.readyState If(xmlhttp.readyState = 4) then WSStatus = xmlhttp.status writeLog "WSStatus = " & WSStatus WSResponse = xmlhttp.responseText writeLog "WSResponse = " & WSResponse WSResponse = xmlhttp.responseBody writeLog "WSResponseBody = " & WSResponseBody else writeLog "ERROR : readyState = " & xmlhttp.readyState & " : " end if
There are no errors, all appears to be fine. The length is correct, the readyState is 4 however the WS returns an HTTP 409. The custom message returned is 'inbound not ok encoding="UTF-8" is missing'
This implies that this node is missing the encoding="utf-8"? however its not. Its 100% there. The XML looks like so:
<?xml version="1.0" encoding="utf-8"?> <ORDERS05> <IDOC BEGIN="1"> <EDI_DC40 SEGMENT="1"> <TABNAM><![CDATA[EDI_DC40]]></TABNAM> <IDOCTYP>aaa</IDOCTYP> <MESTYP>sss</MESTYP> <SNDPOR>ddd</SNDPOR> </EDI_DC40> </IDOC> </ORDERS05>
Here is the start of the log trace from the webService people. Note the
POST /dir/anotherDir HTTP/1.1 content-type: application/x-www-form-urlencoded; charset=UTF-8 connection: close soapaction: processRequest accept-language: en-au content-length: 4699 accept: */* user-agent: Mozilla/4.0 (compatible; Win32; WinHttp.WinHttpRequest.5) host: test.aURLHere.co.nz clientprotocol: https ssl_cipher_usekeysize: 128 ssl_cipher_suite: 0005 <?xml version="1.0"?> <ORDERS05> <IDOC BEGIN="1"> <EDI_DC40 SEGMENT="1"> <TABNAM><![CDATA[EDI_DC40]]></TABNAM> <IDOCTYP>aaa</IDOCTYP> <MESTYP>bbb</MESTYP> <SNDPOR>ccc</SNDPOR>
Is is possible my sending has the issue, or could this be being dropped by the webService??? Very stuck on this one. Is it the senders issue or the receiver?
No comments:
Post a Comment