Defines two endpoints, with the same contract for your service implementation. Defines the first to use SOAP, then the second to use JSon :
<service name="YourService"> <endpoint address="rest" binding="webHttpBinding" contract="IYourService" behaviorConfiguration="RestBehavior"/> <endpoint address="soap" binding="wsHttpBinding" contract="IYourService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> <endpointBehaviors> <behavior name="RestBehavior"> <webHttp/> </behavior> </endpointBehaviors>
Then there will be an endpoint at http://.../yourservice.svc/soap and another at http://.../yourservice.svc/rest
[edit] to answer to your comment, what I said is to replace this section :
<services> <service name="WebApi.SoapApi" behaviorConfiguration="ApiBehavior"> <endpoint address="basic" bindingNamespace="http://api.myservice.dk/Basic" contract="WebApi.IApi" binding="basicHttpBinding" bindingConfiguration="ApiBinding" /> </service> <service name="WebApi.JsonApi" behaviorConfiguration="ApiBehavior"> <endpoint address="web" bindingNamespace="http://api.myservice.dk/Web" contract="WebApi.IApi" binding="webHttpBinding" bindingConfiguration="ApiBinding" behaviorConfiguration="JsonBehavior" /> </service> </services>
by :
<services> <service name="WebApi.UniqueApi" behaviorConfiguration="ApiBehavior"> <endpoint address="basic" bindingNamespace="http://api.myservice.dk/Basic" contract="WebApi.IApi" binding="basicHttpBinding" bindingConfiguration="ApiBinding" /> <endpoint address="web" bindingNamespace="http://api.myservice.dk/Web" contract="WebApi.IApi" binding="webHttpBinding" bindingConfiguration="ApiBinding" behaviorConfiguration="JsonBehavior" /> </service> </services>
One service, with two endpoints