Project Description

SMDBehavior is a WCF extention that automagically generate a Service Mapping Description (SMD) of your WCF Service.
SMD is like wsdl but the output format is JSON instead of XML.

This library is mainly targeted toward web developers using SMD aware javascript framework like the Dojo Toolkit.

Getting Started

Download the latest version of SMDBehavior here.
Unzip and paste the dll in your WCF service /bin folder.

Open you app.config or web config and configure it like this :
  • declare a new behavior extension
    <extensions>
      <behaviorExtensions>
        <add name="SMDBehavior" type="FM.WCF.SMDBehavior.SMDBehaviorExtensionElement, FM.WCF.SMDBehavior, Version=0.2.1.0, Culture=neutral, PublicKeyToken=null" />
      </behaviorExtensions>
    </extensions>

note : be sure to specify the correct version of the assembly. At the time of this writting it's labelized 0.2.1.0; but the version number will change, so double check
it correspond to the version you're using.
  • declare or modify your existing serviceBehavior
      <serviceBehaviors>
        <behavior name="ServiceBehavior" >
          <SMDBehavior Indent="true" UrlTemplate="/?smd"/>
        </behavior>
      </serviceBehaviors>
  • Apply the servicebehavior to your service
      <service name="WCFDojoRpc.ClockService" behaviorConfiguration="ServiceBehavior">
        <endpoint address="" behaviorConfiguration="EndPointBehavior" binding="webHttpBinding" name="ClockService" contract="WCFDojoRpc.IClockService"/>
      </service>

Point your browser to your service (for example : http://thor/WCFDojoRpc/ClockService.svc/) and add a trailing "/?smd" in the url.

You should receive a json response like this one :
{
  "envelope": "JSON",
  "target": "http://thor/WCFDojoRpc/ClockService.svc/",
  "services": {
    "GetTime": {
      "transport": "POST",
      "target": "GetTime",
      "parameters": []
    },
    "GetLocalTime": {
      "transport": "POST",
      "target": "GetLocalTime",
      "parameters": [
        {
          "name": "cultureName",
          "type": "System.String"
        }
      ]
    }
  }
}
.

That's it, you're ready to go with your favorite javascript framework that is SMD enabled...
I know Yahoo UI and Dojo support this proposal schema.

Last edited Apr 28, 2009 at 8:35 PM by Fab_Michellonet, version 10