The Problem Solver

Tell me and I will forget
Show me and I will remember
Involve me and I will understand
- Confucius -

Google Ads

This Blog

Syndication

Search

Tags

News





  • View Maurice De Beijer's profile on LinkedIn

Community

Email Notifications

Explore

Archives

Workflow Publish as Web Service and Visual Studio 2008

I am unsure if this is a problem with my PC but when I am building a workflow using the WebServiceInputActivity and choose "Publish as Web Service" from the context menu I get a real helpfull error message Sad

image

No other messages appear so that is less that helpfull.

Fortunatly it isn't all that had to publish the workflow manually. Just add a web service project to the solution and add an ASMX file with the following content:

<%@ WebService Class="WebServiceInput.Workflow1_WebService" %>

The workflow class is named "WebServiceInput.Workflow1" and just add the "_WebService" suffix to it. Next add a reference from the web service project to the assembly containing the workflow.

Don't forget to also add refrences to the System.Workflow.Activities, System.Workflow.ComponentModel and System.Workflow.Runtime assemblies used at runtime.

Next create a WorkflowRuntime config section like so:

        <section name="WorkflowRuntime" 
             type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, 
                   System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, 
                   PublicKeyToken=31bf3856ad364e35"/>

 

and

    <WorkflowRuntime Name="WorkflowRuntime">
        <Services>
            <add type="System.Workflow.Runtime.Hosting.ManualWorkflowSchedulerService, 
                 System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, 
                 PublicKeyToken=31bf3856ad364e35"/>
            <add type="System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService, 
                 System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, 
                 PublicKeyToken=31bf3856ad364e35"/>
        </Services>
    </WorkflowRuntime>

 

Now you should be good to go Smile

 

The only thing now is adding conversation support. Right now you will het this error

"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: Current session has no workflow instance associated with it. Send activation message to start new instance in current session."

even after adding a CookieContainer as I previously described here. The problem is that the cookie is never added to the response as this is done by WorkflowWebHostingModule http module. So to enable conversations just add the following to the web.config.

        <httpModules>
      <add type="System.Workflow.Runtime.Hosting.WorkflowWebHostingModule, 
                 System.Workflow.Runtime, Version=3.0.00000.0, Culture=neutral, 
                 PublicKeyToken=31bf3856ad364e35" 
           name="WorkflowHost"/>
        </httpModules>

Enjoy!

www.TheProblemSolver.nl
http://wiki.WindowsWorkflowFoundation.eu

Published Mon, Apr 28 2008 15:50 by Maurice

Comments

# Workflow Publish as Web Service and Visual Studio 2008 using Vista@ Wednesday, April 30, 2008 4:27 AM

A few days ago I blogged about the &quot;Publish as Web Service&quot; feature not working for me with

# suffix@ Friday, May 02, 2008 6:36 AM

Pingback from  suffix

by suffix

# re: Workflow Publish as Web Service and Visual Studio 2008@ Friday, October 17, 2008 7:37 AM

Thank you for valuable information.

by ...