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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to call a web service with xml

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
I want to call a web service using an xml request file that comforms to the web service's wsdl file. I've seen .net code examples that call the web methods directly, but I want to simply pass an xml request file to the web service and receive an xml response file. Does anyone know how to do this?
 
Lotsa ways to do this. Depends on the language you are using for your web service client (the caller).

You would have better luck in the SOAP forum: forum781

Tom Morrison
 
k5tm,

Thanks for the tip. I re-posted this in the soap forum.

- Dan
 
I figured it out:
Code:
Option Explicit

Const sRequestFileName = "I:\Development\WesternSurplus\AutomatedFeed\CallGWSISTest\request.xml"
Const sResponseFileName = "I:\Development\WesternSurplus\AutomatedFeed\CallGWSISTest\response.xml"

Sub Main()
   Dim objHTTP As MSXML.XMLHTTPRequest
   Dim sRequest As String
   Dim sResponse As String
   Dim lFileHandle As Long
   
   'Create the SOAP Envelope
   
   lFileHandle = FreeFile
   Open sRequestFileName For Input Access Read As lFileHandle
   sRequest = Input(FileLen(sRequestFileName), lFileHandle)
   Close lFileHandle
   
   'Set up to post to our local server
   Set objHTTP = New MSXML.XMLHTTPRequest
   objHTTP.open "post", _
     "[URL unfurl="true"]http://admw2k3-gws1/gwsis/integrationservice.asmx",[/URL] 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 "SOAPAction", _
      "[URL unfurl="true"]http://rebusis.com/webservices/gcs/IntegrationService/ProcessNA"[/URL]

   'Make the SOAP call
   objHTTP.send sRequest

   'Get the return envelope
   
   sResponse = objHTTP.responseText

   Debug.Print sResponse

   lFileHandle = FreeFile
   Open sResponseFileName For Output Access Write As lFileHandle
   Print #lFileHandle, sResponse
   Close lFileHandle
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top