我有http://192.168.15.45:8081/Taqeem.CRM.Appointments.Service.svc?wsdl
服务和方法BookAppointment,我还提到了代码中的参数,它是值。
var url = "http://192.168.15.45:8081/Taqeem.CRM.Appointments.Service.svc?wsdl";
var callparams = {
AppointmentNumber: 'APP-00000003-H042S5',
UserId: '4'
};
var suds = new SudsClient({
endpoint: url,
targetNamespace: 'http://tempuri.org'
});
try {
suds.invoke('BookAppointment', {}, function(xmlDoc) {
var ManifestXML = this.responseText;
console.log(ManifestXML);
var results = xmlDoc.documentElement.getElementsByTagName('ResultCode').text;
console.log('result'+ results);
if (results && results.length>0) {
var result = results.item(0);
label.text = '1 Euro buys you ' + results.item(0).text + ' U.S. Dollars.';
} else {
label.text = 'Oops, could not determine result of SOAP call.';
}
});
} catch(e) {
Ti.API.error('Error: ' + e);
}
我使用了suds.js,当我执行下面的代码时。我得到错误为ActionNotSupport
完整回复:
[INFO] : <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">
a:ActionNotSupported
</faultcode>
<faultstring xml:lang="en-US">
The message with Action 'http://tempuri.org/BookAppointment' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
我觉得我传递了错误的TargetNameSpace但是我已经检查了http://192.168.15.45:8081/Taqeem.CRM.Appointments.Service.svc?wsdl
并且它的好处。我请求检查上面的链接以获取方法列表。
我已经使用了SOAP UI并且它正在执行完美。我得到了完美的回应。