9

I am connecting to a third-party end point via WCF and I have one problem. The schema for the SOAP envelope that is generated by WCF isn't compatible with the end point.

Currently WCF is generating this:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">

But it needs to be this:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing">

I've tested this in soapUI to confirm this is the problem, but how can I control this in WCF? I used the Add Service Reference option in Visual Studio to generate the service.

Any ideas?

Thanks in advance.

Andy

andypike
  • 551
  • 2
  • 9
  • 15

1 Answers1

25

Most likely, you have an issue with the SOAP version. What binding are you using??

basicHttpBinding defaults to SOAP 1.1, while wsHttpBinding defaults to SOAP 1.2

This is SOAP 1.1 (default in basicHttpBinding):

<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

while this is SOAP 1.2 (default in wsHttpBinding):

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">

Possible solutions:

1) either you can just switch bindings and that's all there is - you need to make sure to check for security settings and so on (which differ between basic and wsHttpBinding)

or

2) you need to create your own custom binding and explicitly specify the SOAP version you need

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Which solution worked for you? I have this same problem, but solution 1 is not an option for me. Do I really have to create my own custom binding? – Stefan Moser Mar 23 '11 at 21:47
  • 2
    @stefan moser: if you need SOAP 1.1 with wsHttpBinding or SOAP 1.2 with basicHttpBinding - then yes, you need to create your own custom binding for that (you can do so in config) – marc_s Mar 23 '11 at 21:51
  • Would you mind elaborating here: http://stackoverflow.com/questions/5412666/does-wcf-support-ws-security-with-soap-1-1 – Stefan Moser Mar 23 '11 at 22:54