locked
Custom InstanceStore and WF service (xamlx) RRS feed

  • Question

  • I tried to use XmlWorkflowInstanceStore from WF_WCF_Samples(Application\PurchaseProcess) with my WF Service but I get exception on the client side after invoking a service method - Expected Process received null. (Process is my received operation name)

    I have debugged the XmlWorkflowInstanceStore.TryCommand and for the LoadWorkflowCommand my workflow is loaded from database to context (InstancePersistenceContext) - method ends without any exception - but on the client side i get received null exception. Can someone tell my what i'm doing wrong? Do i have to set some other context arguments? Are there any guidlines for writing a Custom Instance store ( i can't find any decent tutorial)


    udione
    Friday, September 17, 2010 6:57 AM

Answers

  • Hi, udione

    1. How do you use your WF Service, host it by WorkflowServiceHost , or drop it in IIS7 directly or in Appfabric?
    2. ->"but I get exception on the client side after invoking a service method - Expected Process received null. (Process is my received operation name)"
        could you paste the full exact error message?
    3. Does your XmlWorkflowInstanceStore work for a normal WorkflowApplication?

    Here is sample could be helpful:
    http://xhinker.com/post/WF4Xml-persistence-store.aspx

    Regards


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com
    • Marked as answer by Andrew_Zhu Friday, September 24, 2010 7:39 AM
    Tuesday, September 21, 2010 7:22 AM

All replies

  • Hi, udione

    1. How do you use your WF Service, host it by WorkflowServiceHost , or drop it in IIS7 directly or in Appfabric?
    2. ->"but I get exception on the client side after invoking a service method - Expected Process received null. (Process is my received operation name)"
        could you paste the full exact error message?
    3. Does your XmlWorkflowInstanceStore work for a normal WorkflowApplication?

    Here is sample could be helpful:
    http://xhinker.com/post/WF4Xml-persistence-store.aspx

    Regards


    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support. My Blog:http://xhinker.com
    • Marked as answer by Andrew_Zhu Friday, September 24, 2010 7:39 AM
    Tuesday, September 21, 2010 7:22 AM
  • 1. I host it in a console apllication with workflowservicehost.

    2. The exact error message is:

    A value of the wrong type was retrieved from the instance store.  A value of type {http://tempuri.org/}TestStates was expected, but null was encountered instead.

     

     

    Regards


    udione
    Sunday, September 26, 2010 7:48 PM
  • Hi Udione,

    Did you find a solution to this?

    I have the same problem with hosting in a Windows Service (WorkflowServiceHost) and my custom instance store.

    The XML load and save example was a bit basic, I had to do a lot work hard work to get a proper custom store implementation. Eventually I found the MemoryStore from the public CodePlex Microsoft.Activities.UnitTesting source was the best guide. Even so after checking every line of code and behavioural patterns I get the same error.

    For some reason it is not able to find the service type to use in order to satisfy the workflow instance creation. There are some events you can receive and signal to tell the host which service to use, but the docs say you don't need that if you are hosting in a WorkflowServiceHost which is limited to one type per instance. So there should not be any problem for the host to know which type to construct, and at least for me ALL the data and metadata properties were restored.

    Thanks

    Friday, October 7, 2011 4:34 PM
  • Found the problem, was not storing the metadata just the data. There are some key values required which must be persisted. In this case the InstanceType returns the XName of the WorkflowHostType which is then in turn the XName of the service. The other metadata values are necessary for cloud hosting by the looks of it (site name and relative path). It's all to do with re-activating a generic service from what I gather from the limited documentation. In our case we have a WorkflowServiceHost which by design is limited to one type per configured/created instance. So it really should not have required this information, but fair enough metadata must be stored.


    • Edited by Code Chief Sunday, October 9, 2011 11:36 PM
    Sunday, October 9, 2011 4:16 PM
  • This is regarding custom instance store for workflow service host.

     

    The sample pointed in the link  http://msdn.microsoft.com/en-us/library/ee829481.aspx

    is to demo- how to use the custom instance store with workflow application and not with workflow service host.

    When the custom instance store in sample application is used with workflow service host, it does not work as expected.

     

    The LoadWorkflowCommand is send to instance store’s BeginTryCommand method before SaveWorkflowCommand

    As there is no workflow instance persisted , load command fails with object reference error.

    Looks like the code related to workflow service host is missing in the custom instance store.

     

    Could you provide the sample\ code snippet where workflow service host works with custom instance store?



    From my thread on MSDN

    Monday, November 19, 2012 1:18 PM