XML : Post XML to webService. Cant get past readyState of 1

This VBScript will be running in a .VBS file. It objective is to simply pass the contents of an XMl file. Can anyone tell me why this code only gets to a readyState = 1:

      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, true, 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)           If(xmlhttp.readyState = 4) then             XMLResponse = xmlhttp.responseText             writeLog ".readyState = " & xmlhttp.readyState & " : " & XMLResponse         else          writeLog "..readyState = " & xmlhttp.readyState & " : "      end if    

The output in the log file tells me the XML is loaded and ready to POST:

  XML len = 7038  ..readyState = 1 :    

So its reading the file no worries. I have triple checked the webService URL, UN and Password...

MSDN definition of 1 is LOADING - The object has been created but the send method has not been called.

There are no errors at all. Any ideas on what I may have missed ??

No comments:

Post a Comment