Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 74,098 times

Contents

Related Categories

XML SOAP - VB Client Code

VB Client Code

Sub Main()
  Dim objHTTP As New MSXML.XMLHTTPRequest
  Dim strEnvelope As String
  Dim strReturn As String
  Dim objReturn As New MSXML.DOMDocument
  Dim dblTax As Double
  Dim strQuery As String
 
  'Create the SOAP Envelope
  strEnvelope = _
    "<soap:envelope xmlns:soap=""urn:schemas-xmlsoap-org:soap.v1"">" & _
    "<soap:header></soap:header>" & _
    "<soap:body>" & _
    "<m:getsalestax xmlns:m=""urn:myserver/soap:TaxCalculator"">" & _
    "<salestotal>100</salestotal>" & _
    "</m:getsalestax>" & _
    "</soap:body>" & _
    "</soap:envelope>"
 
  'Set up to post to our local server
  objHTTP.open "post", "http://localhost/soap.asp", False
 
  'Set a standard SOAP/ XML header for the content-type
  objHTTP.setRequestHeader "Content-Type", "text/xml"
 
  'Set a header for the method to be called
  objHTTP.setRequestHeader "SOAPMethodName", _
    "urn:myserver/soap:TaxCalculator#GetSalesTax"
 
  'Make the SOAP call
  objHTTP.send strEnvelope
 
  'Get the return envelope
  strReturn = objHTTP.responseText
 
  'Load the return envelope into a DOM
  objReturn.loadXML strReturn
 
  'Query the return envelope
  strQuery = _
    "SOAP:Envelope/SOAP:Body/m:GetSalesTaxResponse/SalesTax"
  dblTax = objReturn.selectSingleNode(strQuery).Text
 
  Debug.Print dblTax
End Sub

Comments

  • Posted by kpma_l on 19 May 2004

    [quote][1]Posted by [b]kpma_l[/b] on 19 May 2004 04:05 PM[/1]
    I tried to copy the the code and add references to VB project and run the VB app. but get runtime error at the DOMDocument object accesin...

  • getting Runtime error 91 - object or with block va

    Posted by kpma_l on 19 May 2004

    I tried to copy the the code and add references to VB project and run the VB app. but get runtime error at the DOMDocument object accesing a single node.

    Run time error 91.

    MSXML2 and MTS Admin ...

  • WebServices

    Posted by shirikok on 01 Apr 2004

    In .NET web services; How to monitor from where (mostly his/her web site URL but not his/her machine IP) requester is consuming the web service? Techies, [b]'HTTP_REFERER' [/b] and [b]'URLReferrer'[/b...

  • XML SOAP - ASP

    Posted by shirikok on 01 Apr 2004

    Great work by ComponentSource and they have very well explained VB 6.0 client and access to web service. I have a question here. How to monitor from where (mostly his/her web site URL not his/her mac...

  • got the same ???????+???...

    Posted by synapticdata on 20 Nov 2003

    if anyone knows the meaning of this, i could use the feedback. my hunch is, that the SOAP server is not configured to handle the request properly. but i dunno... =)