我一直在尝试使用nodejs的node-soap库来使用soap服务,但是当我发送我的请求时,来自服务的响应是我请求中的flightNumber为null。
我还尝试以xml格式在soap UI中发送对我有用的相同请求,但我收到了相同的错误消息。
这是我的要求:
var request = {
"body" : {
"DisplayFlightLegsRQ": {
"flightNumber": "222",
"airlineCode": "BB",
"departureIATACode": "MIA"
"flightDate": {
"departureDateCondition": "SCHEDULE",
"requestTimeStandard": "UTC",
"departureDate": "10-10-2015"
}
}
},
"headers": {"Content-Type": "text/xml;charset=UTF-8"}
}
致电肥皂服务:
soap.createClient(url,function(err, client){
client.addHttpHeader('App-name', 'fs');
client.setSecurity(new soap.BasicAuthSecurity('***', '***'));
client.displayFls(request, function(err, result, body) {
console.log(result.body);
parseString(body, function(err, result){
var requestResult = result['SOAP-ENV:Envelope']['SOAP-ENV:Body'][0].DisplayFlightLegsRS[0].return[0];
console.log(requestResult);
})
});
});
这个soap-node库中是否有可能导致我的请求发送空参数?我在发送之前调试了请求,并且对象格式正确并且具有所有值。也许这个库正在从 json 请求到 xml 进行内部转换,并且在这个过程中正在擦除值?或者我的请求可能缺少一些东西。
我很感激任何帮助。
谢谢 :)