在工作​​流服务使用外部SOAP服务工作、SOAP

2023-09-03 07:02:46 作者:你丑没事我瞎

我使用了.NET 4的框架,并取得了一个WCF工作流服务应用程序。

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

我想用一个SOAP的Web服务(.NET 3.5)我在VS的另一个实例中运行中暴露的唯一方法是:

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:

在添加服务引用 提供的WSDL(操作显示在操作中如预期) 单击确定 生成解决方案,以确保服务显示我的工具箱 从工具箱中的服务拖动到工作流

不过,当我看到在工作流程中的服务的属性,有没有办法来指定输入参数或在哪里存储服务调用的结果。

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.

我只有指定一些不起眼的参数,如身体的选项:InArgument< ReverseRequestBody outBody:OutArgument< ReverseResponseBody (其中没有一个是字符串)。

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:

因此​​,我的问题是:

My question is therefore:

是否有可能在所有的通过指定一个字符串作为输入参数(像它是指被使用)使用SOAP服务,并且也将结果分配至工作流变量?

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?

在换句话说,如何我做 outBody 上面对应图片的参数和返回Web服务的价值呢?

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?

推荐答案

我使用的是ASMX样式的Web服务,在这里,而不是一个WCF服务猜测。

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

如果这样添加服务引用的作品,但并不完全能够做到最优的事情。你应该能够得到的东西由车身设置为新ReverseRequestBody()并指定输入字符串工作作为身体的一部分。用同样的方法与输出 ReverseResponseBody ,因为它包含生成的字符串作为响应身体的一部分。

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.