Accessing the URI Template Arguments.

Given

  • An HTTP Receive Activity configured with a Uri Template
UriTemplateReceive.png
  • The body of the activity accesses the Uri Template arguments and formats them into a string using the expression
Note: The UriTemplate class converts argument names to UPPERCASE and the dictionary lookup is case sensitive.
response = String.Format("Arg1 = {0}, Arg2 = {1}, Q1 = {2}, Q2 = {3}", args("ARG1"), args("ARG2"), args("Q1"), args("Q2"))

When

The HTTP Workflow Service is invoked with the Uri GET /Foo/Bar?q1=val1&q2=val2
GET http://127.0.0.1:8080/Foo/Bar?q1=val1&q2=val2 HTTP/1.1
Accept: application/json
Host: 127.0.0.1:8080
Connection: Keep-Alive

Then

  • The Body of the service is invoked
  • The HTTP response message contains the body with the string using the requested JSON encoding
HTTP/1.1 200 OK
Content-Length: 46
Content-Type: application/json; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
WorkflowInstance: ce7338db-cd64-4148-9fd5-1c75cfbacaba
Date: Mon, 29 Aug 2011 21:11:16 GMT

"Arg1 = Foo, Arg2 = Bar, Q1 = val1, Q2 = val2"

Tracking Data

This tracking data shows the activity trace from a unit test
0: WorkflowInstance "DynamicActivity" is Started
1: Activity [null] "null" scheduled child activity [1] "DynamicActivity"
2: Activity [1] "DynamicActivity" is Executing
3: Activity [1] "DynamicActivity" scheduled child activity [1.1] "HttpReceive"
4: Activity [1.1] "HttpReceive" is Executing
5: HttpReceive [1.1] "HttpReceive" UriTemplate GET|http://ipv4.fiddler:8080/{arg1}/{arg2}?q1={q1}&q2={q2}
6: WorkflowInstance "DynamicActivity" is Idle
7: Bookmark "GET|http://ipv4.fiddler:8080/{arg1}/{arg2}?q1={q1}&q2={q2}" resumed with payload <HttpWorkflowResource Hash:27581143 TestName: GetCanEchoRequestUri TestInfo: > owner [1.1] "HttpReceive"
8: Activity [1.1] "HttpReceive" scheduled child activity [1.2] "Assign"
9: Activity [1.2] "Assign" is Executing
{
    Arguments
        Value: Arg1 = Foo, Arg2 = Bar, Q1 = val1, Q2 = val2
}
10: Activity [1.2] "Assign" is Closed
{
    Arguments
        Value: Arg1 = Foo, Arg2 = Bar, Q1 = val1, Q2 = val2
        To: Arg1 = Foo, Arg2 = Bar, Q1 = val1, Q2 = val2
}
11: HttpResponse [1.1] "HttpReceive" result Arg1 = Foo, Arg2 = Bar, Q1 = val1, Q2 = val2
12: Activity [1.1] "HttpReceive" is Closed
13: Activity [1] "DynamicActivity" is Closed
14: WorkflowInstance "DynamicActivity" is Completed
Microsoft.ApplicationServer.Http.ObjectContent, Headers:
{
  WorkflowInstance: 9b32415c-2618-4dc7-8afe-94ee8ff995b0
  Content-Type: application/json
}
15: WorkflowInstance "DynamicActivity" is Deleted

Last edited Aug 29, 2011 at 9:17 PM by ronjacobs, version 4

Comments

No comments yet.