Hello! I get the ID from the web page using the following jquery.SOAP script:
$(document).ready(function () { $('tr').click(function () { id = $(this).attr('id'); $.soap({ url: "http://localhost:8123/C_M_Service/", method: "OrdersByPassport", SOAPAction: "http://localhost:8123/C_M_Service/OrdersByPassport", soap11: true, data: '<passport>'+ id + '</passport>', error: function (soapresponse) { alert("Oh no is error: " + soapresponse.toString()); }, success: function (result) { alert("OK " + result.toString()); } }); });
});
The script calls the Operation Contract of the WCF service:
[OperationContract(Action = "http://localhost:8123/C_M_Service/OrdersByPassport")] [WebGet(RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)] [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped)] string OrdersByPassport(int passport);
...
public string OrdersByPassport(int passport) { Repository repository = new Repository(); Query_result qr = new Query_result(); qr.data = repository.GetOrdersByPassport(passport); return (qr.ToString()); }
When using the WCF test client, there are no problems. When the web page interacts with the service, an error occurs when transferring data from the service: "Error deserializing the request message body for the operation" OrdersByPassport. " // C_M_Service ". Found the node type" Element "with the name" passport "and the namespace" "". Please help with this problem.