Thursday, 17 January 2013

Interoperable Web Service Demo

Common scenario

I've been involved in interfacing to WCF using other tools than Visual Studio (Delphi) more than once. Short discussion can be found at Interoprable WCF. I thought it would be a good idea to have a reference service available and this is how the idea of Echo Service was born. Echo Service illustrates typical issues associated with accessing web services - calling a method with parameters of simple and complex type, handling declared and undeclared exception, as well as downloading a large binary data.

The Implementation

The Interoperable Web Service Demo is currently hosted in http://aspspider.info/burzyn/echoservice.svc. Apart from BasicHttpBinding, it exposes WsHttpBinding and WebHttpBinding at http://aspspider.info/burzyn/echoservice.svc/ws and http://aspspider.info/burzyn/echoservice.svc/web respectively. WebHttpBinding can be accessed using the browser with the syntax like:
http://aspspider.info/burzyn/echoservice.svc/web/echostring?value=test1.

Here's the the 'service.model/ group from web.config:
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="Metadata" name="Altaira.Demos.EchoService">
        <endpoint name="BindingInterop" address="" binding="basicHttpBinding" bindingConfiguration="" contract="Altaira.Demos.IEchoService"/>
        <endpoint name="BindingREST" address="web" binding="webHttpBinding" behaviorConfiguration="WebBehavior" contract="Altaira.Demos.IEchoService"/>
        <endpoint name="BindingStandard" address="ws" binding="wsHttpBinding" contract="Altaira.Demos.IEchoService"/>
        <host>
          <baseAddresses>
            <add baseAddress="'http://aspspider.info/burzyn/echoservice.svc"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="WebBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="Metadata">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
 Note that includeExceptionDetailinFaults is set to 'false'. It' intended for testing the scenario when an undeclared exception is raised on the server side, so that the CommunicationException is raised rather than  FaultException. You can test it calling UndeclaredFault() method.

Further information is available at request.




No comments:

Post a Comment