tags:

views:

151

answers:

0

I have a WCF service that I'm trying to get to work with wcf, old soap and plain xml. The service is called TestService.svc and the configuration looks like this:

 <system.serviceModel>
  <behaviors>
   <serviceBehaviors>
    <behavior name="TestServiceBehavior">
     <serviceMetadata httpGetEnabled="true"/>
     <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
   </serviceBehaviors>
   <endpointBehaviors>
    <behavior name="poxBehavior">
     <webHttp/>
    </behavior>
   </endpointBehaviors>
  </behaviors>
  <services>
   <service behaviorConfiguration="TestServiceBehavior" name="TestService">
    <endpoint address="" binding="wsHttpBinding" contract="ITestService">
     <identity>
      <dns value="localhost"/>
     </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    <endpoint address="soap" binding="basicHttpBinding" contract="ITestService"/>
    <endpoint address="xml" binding="webHttpBinding"  behaviorConfiguration="poxBehavior" contract="ITestService"/>
   </service>
  </services>
 </system.serviceModel>

I got this code from this other question: http://stackoverflow.com/questions/186631/rest-soap-endpoints-for-a-wcf-service

Now, the XML webHttpBinding seems to work well, but the wsHttpBinding and basicHttpBinding does not work very well.

I can browser to the service using: http://localhost:8295/WCFTest/TestService.svc

I can also use that endpoint to add a service reference in an asp.net web site project and attempt to consume the service, but when I create the client:

TestService.TestServiceClient mytest = new TestService.TestServiceClient();

It says to specify an endpoint due to multiple endpoints. I guess due to having both wsHttp and basicHttp? How do I specify the endpoint here?

Next I try to consume the basicHttpBinding endpoint by adding a Web Reference (not service reference) to a .net 2.0 web site. At this point I'm not able to add the reference and receive an error 400.

So next I remove the wsHttp binding and am able to add the web reference and consume the service via a .net 2.0 client.

How do I configure it so that I can use wsHttpBinding for clients that can consume normal WCF services, basicHttpBinding for clients that can only consume older non-WCF SOAP requests and still have webHttpBinding available for clients that want to consume plain xml?