我在这里阅读了有关发送RAW xml请求的文档:https://www.npmjs.com/package/soap#example-with-xml-string-for-the-args
在提到的文档中有一个示例:
var args = { _xml: "<ns1:MyRootElement xmlns:ns1="http://www.example.com/v1/ns1">
<ChildElement>elementvalue</ChildElement>
</ns1:MyRootElement>"
};
我已经做了同样的事情,并定义了我的参数,但是我没有得到 org.xml.sax.SAXParseException;。 lineNumber:1; columnNumber:390;元素的内容必须包含格式正确的字符数据或标记。来自SOAP服务器的错误消息
这是我的参数定义:
let args = {
_xml: '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://WSDLPROVIDER" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'
+ '<SOAP-ENV:Body>'
+ '<ns1:enqueue>'
+ '<domain xsi:type="xsd:string">XXXXDOMAINXXXX</domain>'
+'<messageBodies SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">Hello</item>'
+ '</messageBodies>'
+ '<recipientNumbers SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">0936XXXX</item>'
+ '<item xsi:type="xsd:string">0918XXXX</item>'
+ '</recipientNumbers>'
+ '<senderNumbers SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">3000XXX</item>'
+ '</senderNumbers>'
+ '<encodings xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<udhs xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<messageClasses xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<priorities xsi:type="SOAP-ENC:Array" />'
+ '<checkingMessageIds SOAP-ENC:arrayType="xsd:long[2]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:long">102</item>'
+ '<item xsi:type="xsd:long">103</item>'
+ '</checkingMessageIds>'
+ '</ns1:enqueue>'
+ '</SOAP-ENV:Body>'
+ '</SOAP-ENV:Envelope>'
}
当我尝试console.log(client.lastRequest)
时,它将返回以下内容:
last request: <?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:impl="http://magfa.com/soap/SOAPSmsQueue" xmlns:intf="http://magfa.com/soap/SOAPSmsQueue" xmlns:tns1="urn:SOAPSmsQueue" xmlns:ns1="http://magfa.com/soap/SOAPSmsQueue"><soap:Header></soap:Header><soap:Body><impl:enqueue>**<$value>**<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://WSDLPROVIDER" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:enqueue><domain xsi:type="xsd:string">XXXXXDOMAINXXXX</domain><messageBodies SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">Hello</item></messageBodies><recipientNumbers SOAP-ENC:arrayType="xsd:string[2]"
xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">09367xxxx</item><item xsi:type="xsd:string">09189xxxx</item></recipientNumbers><senderNumbers SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">3000xxxx</item></senderNumbers><encodings xsi:nil="true" xsi:type="SOAP-ENC:Array" /><udhs xsi:nil="true" xsi:type="SOAP-ENC:Array" /><messageClasses xsi:nil="true" xsi:type="SOAP-ENC:Array" /><priorities xsi:type="SOAP-ENC:Array" /><checkingMessageIds SOAP-ENC:arrayType="xsd:long[2]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:long">102</item><item xsi:type="xsd:long">103</item></checkingMessageIds></ns1:enqueue></SOAP-ENV:Body></SOAP-ENV:Envelope>**</$value>**</impl:enqueue></soap:Body></soap:Envelope>
有什么方法可以发送