如有任何帮助,我们将不胜感激;我已经做了几天了。
下面是我到目前为止得到的代码;不幸的是,当我运行它时,我收到 HTTP 415 错误;无法处理消息,因为内容类型为“text/xml;” charset=UTF-8' 不是预期的类型 'application/soap+xml;字符集=utf-8'.
我必须发送 application/soap+xml 的内容类型,因为这是 Web 服务允许的唯一类型;我必须用经典的 ASP 来做。
我尝试将“发送”行更改为“objRequest.send objXMLDoc.XML”,但这给了我一个HTTP 400 错误请求 error.
strXmlToSend = "<some valid xml>"
webserviceurl = "http://webservice.com"
webserviceSOAPActionNameSpace = "avalidnamespace"
Set objRequest = Server.createobject("MSXML2.XMLHTTP.3.0")
objRequest.open "POST", webserviceurl, False
objRequest.setRequestHeader "Content-Type", "application/soap+xml"
objRequest.setRequestHeader "CharSet", "utf-8"
objRequest.setRequestHeader "action", webserviceSOAPActionNameSpace & "GetEstimate"
objRequest.setRequestHeader "SOAPAction", webserviceSOAPActionNameSpace & "GetEstimate"
Set objXMLDoc = Server.createobject("MSXML2.DOMDocument.3.0")
objXMLDoc.loadXml strXmlToSend
objRequest.send objXMLDoc
set objXMLDoc = nothing
这是我过去成功使用过的:
Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
xmlhttp.open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
xmlhttp.setRequestHeader "SOAPAction", "http://www.mydomain.com/myaction"
xmlhttp.send postdata
xml = xmlhttp.responseText
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)