SOAP services can publish metadata that describes the methods that may be invoked by clients. Clients can use tools such as Visual Studio to automatically generate code (known as client proxies). The proxies hide the complexity of invoking a service. To invoke a service, one merely invokes a method on a client proxy.
First you must add a metadata endpoint to your service. Assuming your service looks the same as the one defined in the "First service and host" example, you can make the following changes to the configuration file.
<system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="serviceBehaviour"> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service name="Service.Example" behaviorConfiguration="serviceBehaviour"> <endpoint address="mex" binding="mexHttpBinding" name="mexExampleService" contract="IMetadataExchange" /> <endpoint name="netTcpExample" contract="Service.IExample" binding="netTcpBinding" /> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:9000/Example" /> <add baseAddress="http://localhost:8000/Example" /> </baseAddresses> </host> </service> </services> </system.serviceModel>
The mexHttpbinding exposes the interface over http, so now you can go with a web browser to
and it will display the service and its metadata.