WCF error calling Ws2007HttpBinding

1k views Asked by At

I am trying to get data from a WCF ws2007HttpBinding service but I am getting the following error every time I run it:

Content Type application/soap+xml; charset=utf-8 was not supported by service 
http://localhost/GoldInSacks.MutualFunds.local/MutualFunds.svc.  The client
and service bindings may be mismatched.

The InnerException reads this:

The remote server returned an error: (415) Cannot process the message because 
the content type 'application/soap+xml; charset=utf-8' was not the expected 
type 'text/xml; charset=utf-8'..

The system.ServiceModel section of the web.config looks like this:

<system.serviceModel>
    <services>
        <service name="GoldInSacks.MutualFunds">
            <endpoint address="" 
                      binding="ws2007HttpBinding" 
                      contract="GoldInSacks.MutualFunds.Local.IMutualFunds" />
        </service>
    </services>

    <bindings>
        <ws2007HttpBinding>
            <binding>
                <security mode="None" />
            </binding>
        </ws2007HttpBinding>
    </bindings>
</system.serviceModel>

and the client code which is currently running in a console application looks like this:

        EndpointAddress address = 
            new EndpointAddress("http://localhost/MutualFunds.local/MutualFunds.svc");

        var binding = new WS2007HttpBinding();
        binding.Security.Mode = SecurityMode.None;

        ChannelFactory<IMutualFundsChannel> channelFactory = 
            new ChannelFactory<IMutualFundsChannel>(binding, address);
        IMutualFundsChannel channel = channelFactory.CreateChannel();

        var mf = channel.GetMutualFundsByCustomer(1);

        channel.Close();

        foreach (var m in mf)
        {
            System.Console.WriteLine(m.Name);
        }

        System.Console.ReadLine();

The error occurs on the call to GetMutualFundsByCustomer.

I did try wsHttpBinding as well but it gave the same error.

Does anybody know how to make this work?

(I apologize for the terseness of this question but it's late and I need sleep).

1

There are 1 answers

0
Jocke On

Are you using the same SOAP version on client and service side? Perhaps related? http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/f29cd9c8-3c89-43d2-92ae-d2a270ab86b9/

Cheers --Jocke