我目前正在NodeJS中处理一个SOAP项目,对SOAP还很陌生。我的问题是关于客户返回的结果。
const express = require('express')();
const soap = require('strong-soap').soap;
//const Promise = require('promise');
const bodyParser = require('body-parser');
var service = { ... };
var request = { ... };
let url = 'http://localhost:XXXX/wsdl?wsdl';
const clientPromise = () =>
soap.createClient(url, {}, (err, client) => {
client.addSoapHeader('...');
client.MyMethod(request).then(res => console.log(res));
});
运行此脚本后,客户端。MyMethod函数返回一个对象,看起来像这样:
{
result: undefined
envelope: "s'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>n' +
'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">n' +
' <soap:Header/>n' +
' <soap:Body>n' +
' <_U>0</_U>n' +
' <_V>1</_V>n' +
' <_W>n' +
' <UnlockConnector>n' +
' <status>Accepted</status>n' +
' </UnlockConnector>n' +
' <_X/>n' +
' </soap:Body>n' +
'</soap:Envelope>',"
SOAPHeaders: undefined
}
我的问题是为什么远程服务器会返回这样的响应?结果未定义意味着什么?为什么SOAP头是未定义的?我只看到信封。此响应是否意味着流程成功执行?请照亮我!感谢
看起来这与您的WSDL 有关
http://localhost:XXXX/wsdl?wsdl