Reputation: 20078
i am new to wcf and below is what the WCF WSDL returns, my question is, how to call a WCF service from html page?
<wsdl:definitions name="MyService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
- <wsdl:types>
- <xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://..../tools/MyService.svc?xsd=xsd0" namespace="http://tempuri.org/" />
<xsd:import schemaLocation="http://..../tools/MyService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="http://..../tools/MyService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/MyService" />
</xsd:schema>
</wsdl:types>
Upvotes: 0
Views: 907
Reputation: 1979
like so:
$.ajax({
url: "/tools/MyService.svc/Getist",
type: "GET",
context: document.body,
contentType: 'application/json; charset=utf-8',
datatype: 'json',
success: function (data) {
// do something
}
});
I am not sure about parameters - they will go after Getist in the URL, but I don't know their names - they are stored in /tools/MyService.svc?xsd=xsd0
Upvotes: 0
Reputation: 33108
You would need to use a javascript library such as jQuery to make an Ajax request to the web service. I recommend searching google along the lines of "jQuery WCF AJAX" and that should give you some useful examples.
Upvotes: 1