Workflow Service Serialization RRS feed

  • Question

  • I have a workflow service that uses the new contract first design (i.e. I created my interface first and the visual studio created the activities to implement the interface).  I had previously used the same interface for a service that wasn't workflow based (just a plain WCF service) and the clients and server used protobuf serialization for communicating (using a custom WCF behavior).  However when I use the same wcf config on the workflow service it doesn't work.  I have looked at the trace output from both the client and server and I can see the data objects being correctly serialized by the client.  The workflow service doesn't throw up any errors until it tried to use the object in the receive activity, at which point it is null (i.e. there is no trace output saying there was a problem deserializing the data at the server side).  If I remove the protobuf behavior it works fine.

    My question then is this...should it be possible to use any serialization method we want on workflow services for communication between clients and the workflow service?  I would have thought that it uses normal WCF under the covers and as such we would be free to add whatever behaviours etc we want to the WCF communication between the workflow and host.

    Thursday, January 17, 2013 3:41 AM

All replies

  • A custom serializer can be added to a WF service via a behavior extension. The behavior extension will need to remove the configured serializer (whatever has been selected in the designer) and then add the custom serializer. Then the behavior extension can be wired up in the config for the service and then set the serviceBehavior for the service endpoint. For example:

             <add name="MySerializerSwitcher" type="MySerializer.MySerializerElement, MySerializer, Version=, Culture=neutral, PublicKeyToken=null"/>

            <behavior name="MyServicerBehavior">
              <MySerializerSwitcher />

    Here are a few links to get you started on the behavior extension.

    Saturday, February 23, 2013 2:37 AM