Deploying (SharePoint) Workflows

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

When deploying workflow you might get sometimes really scaring error messages. Due the complex infrastructure of workflow host which relies on error messages can came back from different layer.
Today on top of all might seat either your application or SharePoint. Depending on who is the first who figure out the issue, message text can vary.

For example take a look on this very scary message: “HTTP Error 503. The service is unavailable”.
If you fiddle this one, you will see something :

Error    1    Error occurred in deployment step 'Activate Features': System.IO.InvalidDataException: A response was returned that did not come from the workflow service. Status code = 503:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""
http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Service Unavailable</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Service Unavailable</h2>
<hr><p>HTTP Error 503. The service is unavailable.</p>
</BODY></HTML>

This error is caused by almost most trivial problem in this area. The Workflow Host itself depends on many service like fabric, broker, Workflow Host etc. This is a valid statement as long you think on message and workflow runtime.
However, Workflow Host has also one more service which is hosted in IIS. If the pool of this one is stopped you will get ERR 503.

image


After pool restart you you can publish the workflow again. If all works fine, publishing message will be sent to topic “SharePoint/default/29fe885c-a358-4810-a0e0-91e08130594e/9823e703-aafd-4f21-997c-56e0f5bde4a3/”. Guids are used to identify the site collection and the application instance which hosts the workflow. Note that the publishing message contains in its body the full workflow definition.

PUT http://office15:12291/SharePoint/default/29fe885c-a358-4810-a0e0-91e08130594e/9823e703-aafd-4f21-997c-56e0f5bde4a3/$Activities/WorkflowXaml_890cea38_2b0f_4355_84fc_5416038d0e05?$overwriteXClass=true&api-version=0.6.0 HTTP/1.1
User-Agent: Microsoft-WF/0.6.0
E2EActivity: yfabtmj4vEGRp0iGI6BHdg==
Accept: application/xml
Content-Type: application/xml
Host: office15:12291
Content-Length: 2261
Expect: 100-continue
Connection: Keep-Alive

<ActivityDefinition xmlns="http://schemas.microsoft.com/workflow/2012/xaml/activities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><Name>WorkflowXaml_890cea38_2b0f_4355_84fc_5416038d0e05</Name><XamlString>&lt;Activity mc:Ignorable="sads" x:Class="Daenet.SpsWFA.Daenet.SpsWFA.Workflow0A.Workflow" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:made="clr-namespace:Microsoft.Activities.Design.ExpressionTranslation;assembly=Microsoft.Activities.Design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities" xmlns:p="wf://workflow.windows.net/$Activities" xmlns:p1="http://schemas.microsoft.com/workflow/2012/xaml/activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;&#xD;
  &lt;Sequence sads:DebugSymbol.Symbol="9xAcjWbVruDz8KXhkQJfU7bzP0M6XFNhbXBsZXNcRGFlbmV0LlNwc1dGQVxEYWVuZXQuU3BzV0ZBXFdvcmtmbG93MEFcV29ya2Zsb3cueGFtbAMqAzgOAgEBLgU1HAIBAjELMVUCAQM="&gt;&#xD;
    &lt;Sequence.Variables&gt;&#xD;
      &lt;Variable x:TypeArguments="s:Guid" x:Name="__ReferenceID0" Name="itemId" /&gt;&#xD;
    &lt;/Sequence.Variables&gt;&#xD;
    &lt;p:GetCurrentItemGuid&gt;&#xD;
      &lt;p:GetCurrentItemGuid.Result&gt;&#xD;
        &lt;OutArgument x:TypeArguments="s:Guid"&gt;&#xD;
          &lt;p1:ExpressionContainerReference x:TypeArguments="s:Guid" DisplayName="itemId"&gt;&#xD;
            &lt;p1:ExpressionContainerReference.Arguments&gt;&#xD;
              &lt;InOutArgument x:TypeArguments="s:Guid" x:Key="itemId"&gt;&#xD;
                &lt;VariableReference x:TypeArguments="s:Guid" Variable="{x:Reference __ReferenceID0}" /&gt;&#xD;
              &lt;/InOutArgument&gt;&#xD;
            &lt;/p1:ExpressionContainerReference.Arguments&gt;&#xD;
            &lt;ArgumentReference x:TypeArguments="s:Guid" ArgumentName="itemId" /&gt;&#xD;
          &lt;/p1:ExpressionContainerReference&gt;&#xD;
        &lt;/OutArgument&gt;&#xD;
      &lt;/p:GetCurrentItemGuid.Result&gt;&#xD;
    &lt;/p:GetCurrentItemGuid&gt;&#xD;
  &lt;/Sequence&gt;&#xD;
&lt;/Activity&gt;</XamlString></ActivityDefinition>


Posted Oct 23 2012, 10:20 PM by Damir Dobric
Filed under: , ,

Comments

Arpit wrote re: Deploying (SharePoint) Workflows
on 01-21-2013 18:38

Hello Damir,

I have installed the workflow manager, created a SP 2013 workflow and it runs just fine.

However, when I try to get 'WorkflowDescription' programmatically, I get an error which doesn't help me getting any further

Workflow is deployed in the list 'Document_Library' and I'm trying the code below:

WorkflowManagementClient client = new WorkflowManagementClient(new Uri("servername/.../Document_Library"));

Collection<WorkflowDescription> descriptions = client.Workflows.Get(0, 1);

When I try to debug this code I get an error:

A response was returned that did not come from the Workflow Manager. Status code = 404:

404 NOT FOUND Client ActivityId : 2609d79a-6dd7-4973-945a-67cebb4a9e24

Any suggestions how I can get past this error, or is there any better way to get workflow details?

Damir Dobric wrote re: Deploying (SharePoint) Workflows
on 01-26-2013 8:52

Your URL is wrong one. WorkflowManagementClient ist the API which is a part of Workflow Manager and not SharePoint. However the URL which you use is the typical SharePoint URL at which no Workflow Manager Listener is running. This is why you get 404.

You should try to figure out the right URI with following example:

workflowmanagerhostname/SharePoint$ChildScopes?$skip=0&$top=64

This example shows how to navigate trough SharePoint scopes in Workflow Manager directly from browser. After you found the right scope use that URL to connect with WFClient API.

developers.de is a .Net Community Blog powered by daenet GmbH.