2

您好我正在尝试调用 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 服务添加一些参数?

4

1 回答 1

0

请参阅现有的How Do I call A WCF Web Service from jQuery?

这是他们给出的解决方案 http://www.west-wind.com/weblog/posts/2008/Apr/21/jQuery-AJAX-calls-to-a-WCF-REST-Service

于 2012-09-20T06:17:30.283 回答