使用SOAP从VBA调用Web服务

8

我正在尝试在Excel宏中调用网络服务:

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      

然后我收到以下回复:

  <?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> 

有没有人之前做过类似的事情?

2个回答

4

您的SOAP操作还应包括方法的命名空间,例如:

"http://tempri.org/PutSchedule"

了解您的服务的命名空间,并将其添加到 PutSchedule 方法名称前面。


2
你能否再具体一些?我知道这条留言已经超过3年了,但这也是论坛存在的意义,不是吗? - Marci-man

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接