node.js - 节点肥皂问题,无效的 xml
问题描述
我花了几个小时来解决这个问题,但仍然无法解决这个问题。如果我使用 Postman 向具有相同请求正文的 API 发送请求,它工作得很好,但在代码中它给了我“无效的 XML”错误。
任何人都知道我在这里做错了什么?
代码片段
const host = "https://staging.familytreedna.com/ftdnawebservice/lifelinehometest.asmx?wsdl";
Soap.createClient(host, function(err, client){
client.on('soapError', function(err, eid){
console.log("REQUEST ERROR", err);
});
client.on('request', function(xml, eid){
console.log("REQUEST SOAP", xml);
});
const _requestParam = {......};
var result1 = client.LifelineHomeTestWS.LifelineHomeTestWSSoap.Create({
message: _requestParam,
});
});
请求正文
<?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:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
<soap:Body>
<Create xmlns="http://tempuri.org/">
<message>
<Authentication>
<UserName>USERNAME</UserName>
<Password>PASSWORD</Password>
</Authentication>
<Order>
<FtdnaOrderId>LH100031</FtdnaOrderId>
<RsOrderId>494648361009</RsOrderId>
<FirstName>Saud</FirstName>
<MiddleName></MiddleName>
<LastName>S.</LastName>
<FamilySurname>S.</FamilySurname>
<Address>abc </Address>
<City>Austin</City>
<State>TX</State>
<Zip>78704</Zip>
<Country>USA</Country>
<PhoneNumber>1341324123</PhoneNumber>
<CustomerEmail>mail@email.com</CustomerEmail>
<TotalPrice>79</TotalPrice>
<Gender>Male</Gender>
<Products>
<Product>
<Name>PRODUCT NAME</Name>
</Product>
</Products>
<Password>PASSWORD</Password>
</Order>
<Date>2018-05-21T19:16:31-04:00</Date>
</message>
</Create>
</soap:Body>
</soap:Envelope>
请求标头
回复
- 故障代码:500
- faultstring: '无效的 XML'
- 详细信息:'错误:意外的结束标记\n行:88\n列:19\n字符:>
- 状态码:500
解决方案
推荐阅读
- octave - 计数或只读实际条目
- vue.js - 通过脚本标签使用 vue.js 时的 Vue.js 插值
- javascript - 如果某事等于某事,则取消提示
- python - Django - SELECT 行相关子项的总和最大,GROUP BY 相关父项
- r - 在 R 中获取 ego 和 alter 的共同点数
- java - java服务器应用程序性能问题
- flutter - 如何在颤动中返回前2页
- javascript - 自动更改图像的轮播 [JS]
- c - 在 C 语言中,我可以使用 `<` 或 `>` 来比较指向 NULL 的指针吗?
- gnuplot - 使用 GNU Plot 绘图,标题基于列名