calling wcf webservice using basichttpbinding without REST or JSON

扶醉桌前 提交于 2019-12-06 02:25:32

For BasicHttpBinding requests, you need to set the SOAPAction header in the HTTP request (that will define which operation should receive the message).

$.ajax({
      type: "POST",
      url: "http://localhost/LOServices/Services/LOService.svc/basic",
      data: theRequest,
      timeout: 10000,
      contentType: "text/xml",
      dataType: "xml",
      async: false,
      headers: { "SOAPAction": "http://tempuri.org/Contract/Operation" }
    });

Notice that the headers option is new in jQuery 1.5, so if you're using an older one, you'll need to use the beforeSend function for that.

Also, you should be able to get more information in the future for errors such as "Bad Request" or "Internal Server Error" by enabling tracing for WCF - the trace will contain more detailed information about the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!