web-services - 如何使用 jQuery 调用 WCF Web 服务 (.svc)

标签 web-services jquery

您好,我正在尝试调用 WCF Web 服务(.svc)

$.ajax({
    url: 'http://www.somedoamin.com/Services/service.svc',
    dataType: "text/xml",
    contentType:'text/xml; charset=utf-8',
    beforeSend: function(xhr){
        // Pass the soap action onto the proxy.
        xhr.setRequestHeader(
            "SOAPAction","http://www.anotherdomain.com/Services/Login"
        );
    },   
    data:soapMessage,
    type: 'POST',
    success: function(res) {
            var myXML = res.responseText;
    console.log('Response ',myXML);  
    },
    error:function(jqXHR, textStatus, errorThrown,exception) {
        console.log('An error occured ');
    }
}); 

我收到错误回调。 “发生错误”

那么,我是否需要向 WCF 服务添加一些参数?

最佳答案

关于web-services - 如何使用 jQuery 调用 WCF Web 服务 (.svc),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12506892/

相关文章:

javascript - Hello bar 应用程序使我的导航移动崩溃。

javascript - Cookie 脚本 - Uncaught ReferenceError : e is not defined

java - 阻止用户访问每个 wsdl 元素

web-services - 如何从excel宏调用Web服务

javascript - 如何在html中打印ajax、jquery、javascript中的数据?

javascript - jQuery:在更改窗口大小时更改 div 的高度

jquery - bootstrap 3 中的 footable 未初始化

web-services - SOAP 是否总是需要 WSDL?

android - 将 G-WAN 用于 Web 服务

wcf - 开源 Web 服务/WCF 媒体流