【问题标题】:How to call WCF Web Service (.svc) using jQuery如何使用 jQuery 调用 WCF Web 服务 (.svc)
【发布时间】:2012-09-20 06:06:42
【问题描述】:

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

【问题讨论】:

  • webservice 是什么样子的? soapMessage 长什么样子?
  • jQuery 在错误处理程序中“说”了什么(textstatus, errorThrown)?
  • 你确定你没有违反same origin policy

标签: web-services jquery


【解决方案1】:
猜你喜欢
  • 2023-03-24
  • 1970-01-01
  • 2021-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多