使用SOAP从VBA调用Web服务 [英] Calling a Webservice from VBA using SOAP
本文介绍了使用SOAP从VBA调用Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
设置objHTTP =新建MSXML.XMLHTTPRequest
objHTTP.Openpost,https://www.server.com/EIDEServer/EIDEService.asmx
objHTTP.setRequestHeaderContent-Type,text / xml
objHTTP。 setRequestHeaderSOAPAction,PutSchedule
objHTTP.send strXML
以下响应:
<?xml version =1.0encoding =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>服务器无法识别HTTP头SOAPAction的值:PutSchedule。< / faultstring>
< detail />
< / soap:Fault>
< / soap:Body>
< / soap:Envelope>
有人在那里做过这样的事情吗?
解决方案
您的SOAP操作还应包括方法的命名空间
例如
http://tempri.org/PutSchedule
了解您的服务的命名空间并将其添加到方法名称PutSchedule前面。
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?
解决方案
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.
这篇关于使用SOAP从VBA调用Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文