Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Services in VBScript

Status
Not open for further replies.

Horsegag9

Technical User
Jan 25, 2005
9
0
0
AU
Hi All,

I am trying to execute the following script:

=====================================================
dim SOAPClient
set SOAPClient = createobject("MSSOAP.SOAPClient")
on error resume next
SOAPClient.mssoapinit(" if err then
wscript.echo SOAPClient.faultString
wscript.echo SOAPClient.detail
end if
wscript.echo SOAPClient.getRate("England","Japan")
if err then
wscript.echo SOAPClient.faultString
wscript.echo SOAPClient.detail
end if
=============================================

Upon execution I receive the following error (no mistypes, this is what it says....)

"Client:The message could not be send to it's destination HRESULT=0x800A13BD"

Does anybody have anything to offer as to why this error occurs and how it can be fixed? Alternatively if anyone has any scripting samples that allow for a call using webservices that would be greatly appreciated.

Thanks in Advance

Horse
 
I think that service may have moved or possibly has some authentication requirement. Here is one that is working today, wrapped in an HTA:

ZipTemp.hta
Code:
<HTML>
  <HEAD>
    <TITLE>SOAP Test</TITLE>
    <STYLE>
      DIV {text-align: center}
    </STYLE>
    <SCRIPT language=VBScript>
      Const WSDLFile = _
        "[URL unfurl="true"]http://www.xmethods.net/sd/2001/TemperatureService.wsdl"[/URL]
      Dim SOAPClient

      Sub window_onload()
        window.resizeTo 500, 200
        txtZip.focus
        'Let window re-render before initializing SOAPClient.
        window.setTimeout "SOAPInit", 50, "VBSCript"
      End Sub

      Sub SOAPInit()
        Set SOAPClient = CreateObject("MSSOAP.SOAPClient")
        On Error Resume Next
        SOAPClient.mssoapinit WSDLFile
        If Err.Number <> 0 Then
          MsgBox "Fault1: " & SOAPClient.faultString & vbNewline _
               & "Detail1: " & SOAPClient.detail
        Else
          btnGo.disabled = False
        End If
      End Sub

      Sub btnGo_onclick()
        Dim strResults

        On Error Resume Next
        strResults = SOAPClient.getTemp(txtZip.value)
        If Err.Number <> 0 Then
          MsgBox "Fault2: " & SOAPClient.faultString & vbNewline _
               & "Detail2: " & SOAPClient.detail
        Else
          divResults.innerText = _
            "Zipcode " & txtZip.value & ", " & strResults & " degrees"
          txtZip.value = ""
          txtZip.focus
        End If
      End Sub

      Sub window_onunload()
        Set SOAPClient = Nothing
      End Sub
    </SCRIPT>
  </HEAD>
  <BODY>
    <DIV style="font-size: 110%">
      SOAP Test - Temperature at a Zipcode, courtesy of:
    </DIV>
    <DIV style="color: blue">
      [URL unfurl="true"]http://www.xmethods.net/sd/2001/TemperatureService.wsdl[/URL]
    </DIV>
    <DIV>&nbsp;</DIV>
    <DIV>
      Enter Zipcode:
      <INPUT type=text id=txtZip size=5 maxLength=5>
      <INPUT type=button id=btnGo value=Go disabled>
    </DIV>
    <DIV>&nbsp;</DIV>
    <DIV id=divResults style="color: red"></DIV>
  </BODY>
</HTML>
Save as an HTA, double-click to run it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top