如何在javascript中处理soap故障

问题描述:

您好我正在使用javascript调用.net.I中的web服务使用http请求来调用web服务,我想处理javascript中的soap故障,怎么样?如何在javascript中处理soap故障

您可以使用jQuery的肥皂,使用SOAP

“这个脚本使用$就发送SOAP与Web服务通信的插件:信封它可以采取XML DOM,XML字符串或JSON作为输入并且响应可以作为XML DOM,XML字符串或JSON返回。“

我还没有尝试过这一点,但它看起来很健壮,容易入门。

实施例:

$.soap({ 
    url: 'http://my.server.com/soapservices/', 
    method: 'helloWorld', 

data: { 
    name: 'Remy Blom', 
    msg: 'Hi!' 
}, 

success: function (soapResponse) { 
    // do stuff with soapResponse 
    // if you want to have the response as JSON use soapResponse.toJSON(); 
    // or soapResponse.toString() to get XML string 
    // or soapResponse.toXML() to get XML DOM 
}, 
error: function (SOAPResponse) { 
    // show error 
} 
}); 

源:https://github.com/doedje/jquery.soap