Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Workflow Manager 1.0 Http Activities

 

Updated: July 12, 2012

Workflow Manager 1.0 provides a set of messaging activities that allow sending outbound messages to Http services. In general each activity represents one Http verb. This topic provides an overview of these activities.

The arguments of the Http activities are very similar, but vary depending on what is relevant to the particular Http operation that the activity encapsulates. The arguments of each activity allow specifying the core set of parameters that need to be set in order to successfully invoke an http service, including:

  • Uri of the service

  • Request headers and content

  • Response headers and content

  • Return status code

  • Security token for secure invocations

The following table lists the properties and arguments that are common across all of the Http activities.

PropertyDescription
InArgument<string> UriThe Uri of the request.
InArgument<DynamicValue> RequestHeadersThe Http headers of the request message.
InArgument<SecurityToken> SecurityTokenEnables a claims-based delegation pattern using the GetS2SSecurityToken activity.

Note: this configures the Http activity to use JsonWebTokens (JWTs) and OAuth2 bearer tokens, and as such can only be used within workflows that are part of a scope secured using S2S. The claims of the caller who instantiates the workflow (i.e. the activation message) are used, and the outbound token is signed using the outbound signing certificate configured for the deployment.
bool RetryOnConnectionFailureEnables automatic retry of requests that fail due to timeout or connection loss using an exponential back-off.
ActivityFunc<HttpStatusCode, DynamicValue, DynamicValue, bool> HttpErrorHandlerEnables handling of the retry logic based on a particular HttpStatusCode, response headers, and response content.
OutArgument<DynamicValue> ResponseHeadersThe Http headers of the response message.
OutArgument ResponseContentThe body contents of the response message.
OutArgument<HttpStatusCode> HttpStatusCodeThe HttpStatusCode of the response message.

Workflow Manager 1.0 provides a set of messaging activities that allow sending outbound messages to Http services. In general each activity represents one Http verb. The following table lists the Http activities available in Workflow Manager 1.0. All of these activities have the common set of arguments and properties described in Http Activity Common Properties. In addition to these common properties and arguments, some of the activities have additional arguments, as described in the Other Arguments column.

ActivityDescriptionOther Arguments
HttpGetGET on an Http service
HttpPostPOST to an Http serviceInArgument RequestContent
HttpPutPUT to an Http serviceInArgument RequestContent
HttpDeleteDELETE to an Http service
HttpMergeFirst class headers to do an update operation using an eTagInArgument RequestContent

InArgument<String> Etag

Specifying the Request and Response Content

When providing the request and response content you can either pass a primitive object, for example a string, number, or date that will be serialized as the request content, or a DynamicValue.

Http activities have a deep integration with DynamicValue: for requests the provided DynamicValue will be automatically serialized to its Json representation and set as the request content for the Http call. For responses the content returned from the server will be loaded into a DynamicValue (this only works if the response is returned as valid Json).

The following code example shows how to use HttpGet to get information from Netflix into a DynamicValue and use some of its properties within an activity:

Variable<DynamicValue> response = new Variable<DynamicValue>();  
Variable<string> name = new Variable<string>();  
Variable<string> synopsis = new Variable<string>();  
Variable<string> releaseYear = new Variable<string>();  
Variable<string> result = new Variable<string>();  
  
Activity sequence = new Sequence  
{  
    Variables = { response, name, synopsis, releaseYear, result },  
    Activities =  
    {  
        // get the data from Netflix  
        new HttpGet  
        {  
            Uri = "http://odata.netflix.com/Catalog/Titles?$filter=Name%20eq%20'The%20Name%20of%20The%20Rose'",  
            ResponseContent = new OutArgument<DynamicValue>(response)  
        },  
  
        // read some properties from the result  
        new GetDynamicValueProperties  
        {  
            Source = response,  
            Properties =   
            {  
                { "d/results(0)/Name", new OutArgument<string>(name) },  
                { "d/results(0)/Synopsis", new OutArgument<string>(synopsis) },  
                { "d/results(0)/ReleaseYear", new OutArgument<string>(releaseYear) }  
            }  
        },  
  
        // create a new string with the properties read the previous step  
        new FormatString  
        {  
            Format = "{0} ({1}): {2}",  
            Arguments =   
            {  
                new InArgument<string>(name),  
                new InArgument<string>(releaseYear),  
                new InArgument<string>(synopsis),  
            },  
            Result = result  
        }  
    }  
};  

System_CAPS_ICON_note.jpg Note

DynamicValue integration with Http activities is supported for services that accept and return content as Json. AtomPub is not currently supported in the DynamicValue integration.

Http Headers in DynamicValue

Http headers are specified as a DynamicValue. To set the headers for an activity, you just need to create an pass a DynamicValue that contains the headers that you want to use.

Variable<DynamicValue> requestHeaders = new Variable<DynamicValue>();  
Variable<DynamicValue> responseHeaders = new Variable<DynamicValue>();  
  
var sequence = new Sequence  
{  
    Variables = { requestHeaders, responseHeaders },  
    Activities =  
    {  
        // setup the headers  
        new BuildDynamicValue  
        {  
            Result = requestHeaders,  
            Properties =   
            {  
                { "Accept", new InArgument<string>("text/plain") },  
                { "Accept-Charset", new InArgument<string>("utf-8") },  
            }  
        },  
  
        // get the data from Netflix  
        new HttpGet  
        {  
            Uri = "http://contoso.com?var1=val",  
            RequestHeaders = requestHeaders,  
            ResponseHeaders = responseHeaders,  
        },  
    }  
};  

Community Additions

Show: