I have a wcf webservice that is exposed through wsHTTPBinding and basicHTTPBinding. The latter specifies it's endpoint address as being "/basic" as in the following:
<endpoint address="/basic" binding="basicHttpBinding" bindingConfiguration="theAwesomeBasicHttpServerBinding" contract="LOServices.Proxy.ServiceContracts.ILOService">
<identity>
<servicePrincipalName value="HTTP/MY_MACHINE_NAME" />
</identity>
</endpoint>
the binding is defined as follows:
<basicHttpBinding>
<binding name="theAwesomeBasicHttpServerBinding" maxReceivedMessageSize="5000000">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
I am trying to call one of the webmethods using jquery. Because this is over a basicHTTPBinding and not RESTful, therefore, I will not be using JSON. I consequently am building the request XML from a previous (successful) call that I made to the service through wcf test client:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/ILOService/GetLoanActions</Action>
</s:Header>
<s:Body>
<GetLoanActions xmlns="http://tempuri.org/">
<request xmlns:d4p1="http://schemas.datacontract.org/2004/07/LOServices.Proxy.Requests" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<d4p1:AssociationNumber>3</d4p1:AssociationNumber>
<d4p1:IgnoreWarnings>false</d4p1:IgnoreWarnings>
</request>
</GetLoanActions>
</s:Body>
</s:Envelope>
The actual javascript that I am using therefore is structured as follows:
function callWs() {
var theRequest = " \
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<s:Header> \
<Action s:mustUnderstand=\"1\" xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">http://tempuri.org/ILOService/GetLoanActions</Action> \
</s:Header> \
<s:Body> \
<GetLoanActions xmlns=\"http://tempuri.org/\"> \
<request xmlns:d4p1=\"http://schemas.datacontract.org/2004/07/LOServices.Proxy.Requests\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"> \
<d4p1:AssociationNumber>3</d4p1:AssociationNumber> \
<d4p1:IgnoreWarnings>false</d4p1:IgnoreWarnings> \
</request> \
</GetLoanActions> \
</s:Body> \
</s:Envelope>";
$.ajax({
type: "POST",
url: "http://localhost/LOServices/Services/LOService.svc/basic",
data: theRequest,
timeout: 10000,
contentType: "text/xml",
dataType: "xml",
async: false
});
}
I'm unfortunate enough to receive a "Bad Request" from the wcf service when I run it in this fashion, however, and that doesn't leave me with much to follow up on.
I've been struggling to try to make this work for at least 3 hours now, so if anyone has ideas, please feel free to jump in with some suggestions.
Thanks.