I created a service and I'm presented with a page saying:
You have created a service.
To test this service, you will need to
create a client and use it to call the
service. You can do this using the
svcutil.exe tool from the command line
with the following syntax:
But how do I tell if its a SOAP or a REST service from that? How would I tell from the wsdl etc?
Service config:
<services>
<service name="VLSContentService"
behaviorConfiguration="VLSContentServiceBehaviour" >
<endpoint name="rest"
address=""
behaviorConfiguration="VLSContentServiceEndpointBehaviour"
binding="webHttpBinding"
contract="IVLSContentServiceREST" />
<endpoint name="soap"
address="soap"
binding="basicHttpBinding"
contract="IVLSContentServiceREST"/>
</service>
</services>
UPDATE:
Hi Mark,
My config is:
<services>
<service behaviorConfiguration="VLSContentServiceBehaviour" name="VLSContentService">
<endpoint name="rest" address="" behaviorConfiguration="VLSContentServiceEndpointBehaviour" binding="webHttpBinding" contract="IVLSContentServiceREST" />
<endpoint name="soap" address="soap" binding="basicHttpBinding" contract="IVLSContentServiceREST"/>
</service>
</services>
So basically I browse to the .svc file and I see a link for a wsdl. But how do I know if thats for the SOAP or REST endpoint. Have I even configured it correctly?
Thanks
UPDATE: 17:49 (UK TIME)
<system.serviceModel>
<!---Add the service-->
<services>
<service behaviorConfiguration="VLSContentServiceBehaviour" name="VLSContentService">
<endpoint name="rest"
address=""
behaviorConfiguration="VLSContentServiceEndpointBehaviour"
binding="webHttpBinding"
contract="IVLSContentServiceREST" />
</service>
</services>
<!---Add the behaviours-->
<behaviors>
<serviceBehaviors>
<behavior name="VLSContentServiceBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="VLSContentServiceEndpointBehaviour">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
</system.serviceModel>
marc_s UPDATE: 18:22 (UK TIME)
Pete, try this – no metadata publishing, nothing – just webHttpBinding
– you should not see any WSDL anymore…
<system.serviceModel>
<services>
<service name="VLSContentService">
<endpoint name="rest"
address=""
binding="webHttpBinding"
contract="IVLSContentServiceREST" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />
</system.serviceModel>
Best Answer
The service can be both REST and SOAP, in a way that a WCF service can have multiple endpoints, including a mix of both SOAP and REST. On the WSDL, the SOAP endpoints will show up in the wsdl:definitions/wsdl:service/wsdl:port element; the REST endpoints will not. So if you only have one endpoint in the service, if there is a wsdl:port entry in the WSDL, then it's a SOAP endpoint; otherwise it's REST.
You can run the code below and look at the wsdl to see that it only shows up one wsdl:port element, for the SOAP endpoint.