0

I am calling a wcf-service like this:

var xmlhttp = new XMLHttpRequest();
xmlhttp.open('POST', 'http://localhost:12525/ElasticServiceProxy.svc', true);
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(soapBody);

The soapBody works if I put it in SoapUI and call the service. I get the correct answer. But in javascript-code it doesn't work.

I also added the Access-Control-Allow-Origin Header in Application_BeginRequest.

I also tried with axios (axios.post(...)) - didn't work.

I get this error: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher

What do I miss?

thx a-x-i

a-x-i
  • 303
  • 5
  • 13
  • [This](https://stackoverflow.com/questions/5487791/contractfilter-mismatch-at-the-endpointdispatcher-exception) SO post lists out possible causes for this error. – rahulaga-msft Feb 28 '18 at 18:55

1 Answers1

0

I got it solved

In Javascript I added this:

xmlhttp.setRequestHeader("soapAction", "namespace/Interface/Operation");

In my wcf I had to add this in Application_BeginRequest:

HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "SoapAction");

So now my WCF works perfect :)

a-x-i

a-x-i
  • 303
  • 5
  • 13