【问题标题】:How to handle soap fault in javascript如何在javascript中处理soap错误
【发布时间】:2013-02-19 06:21:15
【问题描述】:

您好,我正在使用 javascript 调用 .net 中的 web 服务。我使用 http 请求调用 web 服务,我想处理 javascript 中的肥皂错误,如何处理??

【问题讨论】:

    标签: javascript web-services httprequest


    【解决方案1】:

    您可以使用 jQuery Soap,这是一个使用 SOAP 与 Web 服务通信的插件

    “此脚本使用 $.ajax 发送 SOAP:Envelope。它可以将 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多