Hi guys
I'm new to WCF and am trying to get some ideas I have off the ground.
Basically I have a web WCF Application project with the following in its web.config:
<system.serviceModel>
<services>
<service name="WcfService1.ServiceContract.IDirectorySearchService" behaviorConfiguration="defaultServiceBehavior">
<endpoint name="restxml" address="xml" binding="webHttpBinding" contract="WcfService1.ServiceContract.IDirectorySearchServiceXml" behaviorConfiguration="xmlRestBehavior"/>
<endpoint name="restjson" address="json" binding="webHttpBinding" contract="WcfService1.ServiceContract.IDirectorySearchServiceJson" behaviorConfiguration="jsonRestBehavior"/>
<endpoint name="soap" address="soap" binding="basicHttpBinding" contract="WcfService1.ServiceContract.IDirectorySearchService"/>
<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="defaultServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="xmlRestBehavior">
<webHttp/>
</behavior>
<behavior name="jsonRestBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
My interfaces look like this:
[ServiceContract]
public interface IDirectorySearchServiceXml
{
[OperationContract]
[WebGet(UriTemplate = "Search/")]
SearchResults Search();
}
[ServiceContract]
public interface IDirectorySearchServiceJson
{
[OperationContract]
[WebGet(UriTemplate = "Search/")]
SearchResults Search();
}
[ServiceContract]
public interface IDirectorySearchService
{
[OperationContract]
SearchResults Search(int? sportId, int? instituteId, DateTime? startDate, DateTime? endDate);
}
Now the part I am having a little trouble with is what else I need to get this up and running... Like given this what .svc files do I need and do I have the config right... Also what addresses do I need to use to get this running either through the browser or through the WCF test client. Note I am currently using 3.5.
Cheers Anthony
UPDATE:
So If I have something like the following, I would need 3 different svc files... If this is the case then there isn't much point in having address part in the end point...
public class DirectorySearchServiceXml : IDirectorySearchServiceXml
{
...
}
public class DirectorySearchServiceJson : IDirectorySearchServiceJson
{
...
}
public class DirectorySearchService : IDirectorySearchService
{
...
}
But I could create 1 class that exsplictly implments all 3 interfaces, then I would only have 1 svc and then the address becomes relevent... Is that correct?