Loading ...
Sorry, an error occurred while loading the content.

vbscript & webservice access via soap for a newbie

Expand Messages
  • squib142
    I m looking for some help on accessing a webservice using soap & VBScript. The service simply copies a file over to an ftp, but I am having trouble with an
    Message 1 of 1 , Nov 4, 2005
    • 0 Attachment
      I'm looking for some help on accessing a webservice using soap &
      VBScript. The service simply copies a file over to an ftp, but I am
      having trouble with an error stating that the "download of the
      specified resource has failed". Being new to SOAP, I'm not entirely
      sure if I'm going about things in the correct way. Any help would be
      appreciated. I've included the code I have below...

      [code]
      dim sRegionFTP
      dim requestHTTP,requestXML
      dim WebServiceURL,WebMethodName

      WebServiceURL = "https://{serverName}/region.asmx?WSDL"
      WebMethodName = "http://{server}.Public.WS/GetRegionFTP"

      sRegionFTP = sRegionFTP & "<?xml version=""1.0"" encoding=""utf-8""?>"
      sRegionFTP = sRegionFTP & "<soap:Envelope
      xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
      xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
      xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">"
      sRegionFTP = sRegionFTP & " <soap:Body>"
      sRegionFTP = sRegionFTP & " <GetRegionFTP
      xmlns=""http://{server}.Public.WS/"">"
      sRegionFTP = sRegionFTP & " <FTPServerUrl>{ftpServer}</FTPServerUrl>"
      sRegionFTP = sRegionFTP & " <UserName>{username}</UserName>"
      sRegionFTP = sRegionFTP & " <Password>{password}</Password>"
      sRegionFTP = sRegionFTP & " <FileName>{fileToCreate}</FileName>"
      sRegionFTP = sRegionFTP & " </GetRegionFTP>"
      sRegionFTP = sRegionFTP & " </soap:Body>"
      sRegionFTP = sRegionFTP & "</soap:Envelope>"

      on error resume next

      'Set requestXML = CreateObject("MSXML2.DOMDocument")
      'requestXML.loadXML (sRegionFTP)

      set requestHTTP = CreateObject("Microsoft.XMLHTTP")
      requestHTTP.open "POST /region.asmx HTTP/1.1",WebServiceURL, false
      requestHTTP.SetOption 2, 13056 ' Ignore all SSL errors
      requestHTTP.setrequestheader "Host", "{serverName}"
      requestHTTP.setrequestheader "Content-Type", "text/xml; charset=utf-8"
      requestHTTP.setrequestheader "Content-Length", "8"
      requestHTTP.setrequestheader "SOAPAction", WebMethodName
      requestHTTP.send (sRegionFTP)

      if err then
      dim sError
      sError = sError & "err.number : " & err.number & vbCrLf
      sError = sError & "err.description : " & err.description & vbCrLf
      sError = sError & "err.source : " & err.source & vbCrLf
      sError = sError & "err.helpcontext : " & err.helpcontext & vbCrLf
      sError = sError & "err.helpfile : " & err.helpfile & vbCrLf
      msgbox sError, ,"ERROR"
      else
      MsgBox("Request sent. HTTP request status= " & requestHTTP.status)
      end if
      [/code]

      Thanks
    Your message has been successfully submitted and would be delivered to recipients shortly.