Note that there are some explanatory texts on larger screens.

plurals
  1. POGiven the following WSDL how to call the method LoadStaff()?
    text
    copied!<p>Following is the WSDL code of my WCF service, how to call the service Directory.svc from jQuery Ajax? I tried by calling 'Directory.svc/LoadStaff' and 'Directory.svc/Directory/LoadStaff' but I was getting HTTP 400 error.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;wsdl:definitions name="Directory" targetNamespace="Directory" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="Directory" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; &lt;wsdl:types&gt; &lt;xs:schema elementFormDefault="qualified" targetNamespace="Directory" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:import namespace="http://schemas.microsoft.com/Message"/&gt; &lt;xs:element name="LoadStaff"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="domainpath" nillable="true" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="LoadStaffResponse"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="LoadStaffResult" type="q1:StreamBody" xmlns:q1="http://schemas.microsoft.com/Message"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; &lt;xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/"&gt; &lt;xs:element name="anyType" nillable="true" type="xs:anyType"/&gt; &lt;xs:element name="anyURI" nillable="true" type="xs:anyURI"/&gt; &lt;xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/&gt; &lt;xs:element name="boolean" nillable="true" type="xs:boolean"/&gt; &lt;xs:element name="byte" nillable="true" type="xs:byte"/&gt; &lt;xs:element name="dateTime" nillable="true" type="xs:dateTime"/&gt; &lt;xs:element name="decimal" nillable="true" type="xs:decimal"/&gt; &lt;xs:element name="double" nillable="true" type="xs:double"/&gt; &lt;xs:element name="float" nillable="true" type="xs:float"/&gt; &lt;xs:element name="int" nillable="true" type="xs:int"/&gt; &lt;xs:element name="long" nillable="true" type="xs:long"/&gt; &lt;xs:element name="QName" nillable="true" type="xs:QName"/&gt; &lt;xs:element name="short" nillable="true" type="xs:short"/&gt; &lt;xs:element name="string" nillable="true" type="xs:string"/&gt; &lt;xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/&gt; &lt;xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/&gt; &lt;xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/&gt; &lt;xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/&gt; &lt;xs:element name="char" nillable="true" type="tns:char"/&gt; &lt;xs:simpleType name="char"&gt; &lt;xs:restriction base="xs:int"/&gt; &lt;/xs:simpleType&gt; &lt;xs:element name="duration" nillable="true" type="tns:duration"/&gt; &lt;xs:simpleType name="duration"&gt; &lt;xs:restriction base="xs:duration"&gt; &lt;xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/&gt; &lt;xs:minInclusive value="-P10675199DT2H48M5.4775808S"/&gt; &lt;xs:maxInclusive value="P10675199DT2H48M5.4775807S"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;xs:element name="guid" nillable="true" type="tns:guid"/&gt; &lt;xs:simpleType name="guid"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;xs:attribute name="FactoryType" type="xs:QName"/&gt; &lt;xs:attribute name="Id" type="xs:ID"/&gt; &lt;xs:attribute name="Ref" type="xs:IDREF"/&gt; &lt;/xs:schema&gt; &lt;xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Message" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/Message"&gt; &lt;xs:simpleType name="StreamBody"&gt; &lt;xs:restriction base="xs:base64Binary"/&gt; &lt;/xs:simpleType&gt; &lt;/xs:schema&gt; &lt;/wsdl:types&gt; &lt;wsdl:message name="Directory_LoadStaff_InputMessage"&gt; &lt;wsdl:part name="parameters" element="tns:LoadStaff"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:message name="Directory_LoadStaff_OutputMessage"&gt; &lt;wsdl:part name="parameters" element="tns:LoadStaffResponse"/&gt; &lt;/wsdl:message&gt; &lt;wsdl:portType name="Directory"&gt; &lt;wsdl:operation name="LoadStaff"&gt; &lt;wsdl:input wsaw:Action="Directory/Directory/LoadStaff" message="tns:Directory_LoadStaff_InputMessage"/&gt; &lt;wsdl:output wsaw:Action="Directory/Directory/LoadStaffResponse" message="tns:Directory_LoadStaff_OutputMessage"/&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:portType&gt; &lt;wsdl:binding name="BasicHttpBinding_Directory" type="tns:Directory"&gt; &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http"/&gt; &lt;wsdl:operation name="LoadStaff"&gt; &lt;soap:operation soapAction="Directory/Directory/LoadStaff" style="document"/&gt; &lt;wsdl:input&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:input&gt; &lt;wsdl:output&gt; &lt;soap:body use="literal"/&gt; &lt;/wsdl:output&gt; &lt;/wsdl:operation&gt; &lt;/wsdl:binding&gt; &lt;wsdl:service name="Directory"&gt; &lt;wsdl:port name="BasicHttpBinding_Directory" binding="tns:BasicHttpBinding_Directory"&gt; &lt;soap:address location="http://localhost:59440/Directory.svc"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; &lt;/wsdl:definitions&gt; </code></pre> <p>Here is the jQuery code I used to call the service:</p> <pre><code>$.ajax({ url: 'http://localhost:59440/Directory.svc/LoadStaff', type: 'GET', dataType: "json", success: function (data) { //nothing to do yet }, error: function (SOAPResponse) { console.log('oops'); } </code></pre> <p>});</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload