Search code examples
.netwcfsoapworkflow-foundation-4

Using external SOAP service in Workflow service


I am using the .NET 4 framework and have made a WCF Workflow Service Application.

I want to use a SOAP web service (.NET 3.5) I have running in another instance of VS. The only method that is exposed is the following:

[WebMethod]
public string Reverse(string input)
{
    char[] chars = input.ToCharArray();
    Array.Reverse(chars);
    return new string(chars);
}

I have used the following steps to add the service in my Workflow:

  1. Add Service Reference
  2. Provided the WSDL (the operation shows in the Operations box as expected)
  3. Clicked OK
  4. Build the solution to ensure that the service shows in my toolbox
  5. Drag the service from the toolbox into the workflow

However, when I look at the properties of the service in the workflow, there is no way to specify the input argument or where to store the result of the invocation of the service.

I only have the option of specifying some obscure parameters such as Body:InArgument<ReverseRequestBody and outBody:OutArgument<ReverseResponseBody (none of which are strings).

Here is a screenshot depicting the properties of the service in the workflow:

enter image description here

My question is therefore:

Is it possible at all to use the SOAP service by specifying a string as the input argument (like it is meant to be used), and also assign the result to a workflow variable?

In other words, how to I make body and outBody in the picture above correspond to the argument and return value of the web service?


Solution

  • I am guessing you are using an ASMX style web service here and not a WCF service.

    If so Add Service Reference works but isn't quite able to do the optimal thing. You should be able to get things to work by setting the Body to a new ReverseRequestBody() and specifying the input string as part of the body. The same way with the output ReverseResponseBody as it will contain the resulting string as part of the response body.