I've tried changing the 'send' line to "objRequest.send objXMLDoc.XML" but this then gives me a HTTP 400 Bad Request error.strXmlToSend = "<some valid xml>"webserviceurl = "http://webservice.com"webserviceSOAPActionNameSpace = "avalidnamespace"Set objRequest = Server.createobject("MSXML2.XMLHTTP.3.0")objRequest.open "POST", webserviceurl, FalseobjRequest.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 strXmlToSendobjRequest.send objXMLDocset objXMLDoc = nothing推荐答案在传递XML DOM或send方法时,Content-Type始终设置为"text/xml".When you pass an XML DOM ot the send method the Content-Type is always set to "text/xml".如果要控制内容类型,则必须传递一个字符串.不要只为了调用xml属性而将XML字符串加载到DOM中,因为这可能会更改xml声明的内容.顺便说一句,XML声明在XML字符串中看起来像什么,您确定xml是正确的吗? xml上的编码声明(如果存在)应显示"UTF-8".If you want to control the content type then you must pass a string. Don't bother loading the XML string into a DOM only to call the xml property since that may change the content of the xml declaration. BTW what does the xml declaration look like in the XML string and are you certain that the xml is correct? The encoding on the xml declare if present should say "UTF-8".不发送标头CharSet,它没有任何意义,CharSet是Content-Type标头的属性.Don't send a header CharSet it means nothing, CharSet is an attribute of the Content-Type header.不要在ASP内部使用XMLHTTP,这是不安全的.Don't use XMLHTTP from inside ASP its not safe.因此,您的代码应如下所示:-Hence your code ought to look like this:-strXmlToSend = "<some valid xml>"webserviceurl = "http://webservice.com"webserviceSOAPActionNameSpace = "avalidnamespace"Set objRequest = Server.Createobject("MSXML2.ServerXMLHTTP.3.0")objRequest.open "POST", webserviceurl, FalseobjRequest.setRequestHeader "Content-Type", "application/soap+xml; charset=UTF-8"objRequest.setRequestHeader "action", webserviceSOAPActionNameSpace & "GetEstimate"objRequest.setRequestHeader "SOAPAction", webserviceSOAPActionNameSpace & "GetEstimate"objRequest.send strXmlToSend不确定操作"标头对我来说看起来是否多余.也许这仍然会以某种方式失败,但是它不再应该抱怨Content-Type标头.Not sure about that "action" header either looks superflous to me. Perhaps this will still fail in some way but it shouldn't complain about the Content-Type header anymore. 这篇关于使用经典ASP发送"application/soap + xml" SOAP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-10 09:02