Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a Webservice from VBA using SOAP

I'm trying to call a web service in an Excel Macro:

Set objHTTP = New MSXML.XMLHTTPRequest
objHTTP.Open "post", "https://www.server.com/EIDEServer/EIDEService.asmx"
objHTTP.setRequestHeader "Content-Type", "text/xml"
objHTTP.setRequestHeader "SOAPAction", "PutSchedule"
objHTTP.send strXML      

And I get back the following response:

  <?xml version="1.0" encoding="utf-8"?>
  <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
      <soap:Fault>
        <faultcode>soap:Client</faultcode>
        <faultstring>Server did not recognize the value of HTTP Header SOAPAction: PutSchedule.</faultstring>
        <detail />
      </soap:Fault>
    </soap:Body>
  </soap:Envelope> 

Anybody out there done something like this before?

like image 885
Kevin Colyar Avatar asked Oct 27 '08 23:10

Kevin Colyar


People also ask

Can you use VBA to pull data from website?

You can use VBA to extract data from web pages, either as whole tables or by parsing the underlying HTML elements. This blog shows you how to code both methods (the technique is often called "web-scraping").

What is SOAP call web service?

SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web services. SOAP is a W3C recommendation for communication between two applications. SOAP is XML based protocol. It is platform independent and language independent.

How do I connect to SOAP service?

Enter http://www.webservicex.net/periodictable.asmx for “URL to the SOAP web service endpoint” prompt. Enter http://www.webservicex.net/periodictable.asmx?WSDL for “HTTP URL or local fie system path to WSDL file” prompt. Enter “y” to Expose operations as REST APIs. Leave blank to “Maps WSDL binding operations to Node.


1 Answers

You SOAP action should also include namespace of the method e.g.

"http://tempri.org/PutSchedule"

Find out what the namespace of your Service and add it in front of the method name PutSchedule.

like image 113
Ray Lu Avatar answered Oct 31 '22 14:10

Ray Lu