0

我已经使用Wash out gem在 ruby​​ 中创建了一些 Web 服务。到目前为止,一切都很好。使用savon gem获得响应是没有问题的。但是我创建了一个 BPEL 流程并想要调用 Web 服务(它只是 BPEL)!请求没有问题,所以知道我在 ruby​​ soap_service 中并且不知道如何响应回 BPEL 流程!?

    soap_action "concat",
    :args   => { :concatRequest => { :a => :string, :b => :string } },
    :return => { :concatResponse => { :result => :string } }

  def concat
    # something I want to do in ruby
    puts "*******************************************************************"
    puts "************************   CONCAT   *******************************"
    puts "*******************************************************************"
    result = params[:concatRequest][:a] + params[:concatRequest][:b]
    puts "RESULT: " + result
    puts "*******************************************************************"
    # and then send response to BPEL process
    puts render :soap => ( { :concatResponse => {:result => result} } )
  end

BPEL 流程仍在等待响应,没有得到响应!我希望任何人都可以帮助我:-) ...

这是我的 WSDL 文件:

    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:WashOut" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="contextserver" targetNamespace="urn:WashOut">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:WashOut">
<xsd:complexType name="concatRequest">
<xsd:sequence>
<xsd:element name="a" type="xsd:string"/>
<xsd:element name="b" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="concatResponse">
<xsd:sequence>
<xsd:element name="result" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</schema>
</types>
<portType name="contextserver_port">
<operation name="concat">
<input message="tns:concat"/>
<output message="tns:concat_response"/>
</operation>
<operation name="special">
<input message="tns:special"/>
<output message="tns:special_response"/>
</operation>
</portType>
<binding name="contextserver_binding" type="tns:contextserver_port">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="concat">
<soap:operation soapAction="concat"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</output>
</operation>
<operation name="special">
<soap:operation soapAction="special"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:WashOut"/>
</output>
</operation>
</binding>
<service name="service">
<port name="contextserver_port" binding="tns:contextserver_binding">
<soap:address location="http://localhost:3000/contextserver/action"/>
</port>
</service>
<message name="concat">
<part name="concatRequest" type="tns:concatRequest"/>
</message>
<message name="concat_response">
<part name="concatResponse" type="tns:concatResponse"/>
</message>
<message name="special">
<part name="b" type="xsd:string"/>
</message>
<message name="special_response">
<part name="value" type="xsd:string"/>
</message>
</definitions>

这是我在 BPEL 流程调用 Web 服务时得到的错误:

ERROR [INVOKE] Failure during invoke: Unable to process response: SOAP body does not contain expected part wrapper: service {urn:WashOut}service port contextserver_port wrapper {urn:WashOut}concatResponse
INFO  [BpelRuntimeContextImpl] ActivityRecovery: Registering activity 13, failure reason: Unable to process response: SOAP body does not contain expected part wrapper: service {urn:WashOut}service port contextserver_port wrapper {urn:WashOut}concatResponse on channel 24

这是我的 BPEL 流程中的调用操作:

<bpel:invoke name="Invoke" partnerLink="contextserver" operation="concat" portType="ns1:contextserver_port" inputVariable="concatRequest" outputVariable="concatResponse"></bpel:invoke>

concatRequest => 消息“concat” concatResponse => 消息“concat_response”

更新:这是 BPEL 文件:

<!-- TestProcess BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Tue Jul 14 17:53:39 CEST 2015 -->
<bpel:process name="TestProcess"
         targetNamespace="http://localhost:8080/test"
         suppressJoinFailure="yes"
         xmlns:tns="http://localhost:8080/test"
         xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         xmlns:ns1="urn:WashOut">

    <!-- Import the client WSDL -->
    <bpel:import namespace="urn:WashOut" location="concat.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
    <bpel:import namespace="urn:WashOut" location="file:/Users/jordan/development/workflow/app/services/concat.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
    <bpel:import location="TestProcessArtifacts.wsdl" namespace="http://localhost:8080/test" importType="http://schemas.xmlsoap.org/wsdl/" />

    <!-- ================================================================= -->         
    <!-- PARTNERLINKS                                                      -->
    <!-- List of services participating in this BPEL process               -->
    <!-- ================================================================= -->         
    <bpel:partnerLinks>
        <!-- The 'client' role represents the requester of this service. -->
        <bpel:partnerLink name="client"
                     partnerLinkType="tns:TestProcess"
                     myRole="TestProcessProvider"
                     />


        <bpel:partnerLink name="contextserver" partnerLinkType="tns:ContextserverPLT" partnerRole="Concat"></bpel:partnerLink>
    </bpel:partnerLinks>

    <!-- ================================================================= -->         
    <!-- VARIABLES                                                         -->
    <!-- List of messages and XML documents used within this BPEL process  -->
    <!-- ================================================================= -->         
    <bpel:variables>
        <!-- Reference to the message passed as input during initiation -->
        <bpel:variable name="input"
                  messageType="tns:TestProcessRequestMessage"/>

        <!-- 
          Reference to the message that will be returned to the requester
          -->
        <bpel:variable name="output"
                  messageType="tns:TestProcessResponseMessage"/>
        <bpel:variable name="concatRequest" messageType="ns1:concat">
        </bpel:variable>
        <bpel:variable name="concatResponse" messageType="ns1:concat_response">
        </bpel:variable>
    </bpel:variables>

    <!-- ================================================================= -->         
    <!-- ORCHESTRATION LOGIC                                               -->
    <!-- Set of activities coordinating the flow of messages across the    -->
    <!-- services integrated within this business process                  -->
    <!-- ================================================================= -->         
    <bpel:sequence name="main">

        <!-- Receive input from requester. 
             Note: This maps to operation defined in TestProcess.wsdl 
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                 portType="tns:TestProcess"
                 operation="process" variable="input"
                 createInstance="yes"/>

        <!-- Generate reply to synchronous request -->
        <bpel:assign validate="no" name="Assign">
            <bpel:copy ignoreMissingFromData="no" keepSrcElementName="no">
            <bpel:from>
                <bpel:literal xml:space="preserve"><tns:concatRequest xmlns:tns="urn:WashOut" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <tns:a>go</tns:a>
                    <tns:b>go</tns:b>
                    </tns:concatRequest>
                </bpel:literal>
            </bpel:from>
            <bpel:to part="concatRequest" variable="concatRequest"></bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:invoke name="Invoke" partnerLink="contextserver" operation="concat" portType="ns1:contextserver_port" inputVariable="concatRequest" outputVariable="concatResponse"></bpel:invoke>
        <bpel:assign validate="no" name="Assign1">
            <bpel:copy>
                <bpel:from>
                    <bpel:literal xml:space="preserve"><tns:concatResponse xmlns:tns="urn:WashOut" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <tns:result>WORKS</tns:result>
                        </tns:concatResponse>
                    </bpel:literal>
                </bpel:from>
                <bpel:to part="payload" variable="output"></bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:reply name="replyOutput" partnerLink="client" portType="tns:TestProcess" operation="process" variable="output" />
    </bpel:sequence>
</bpel:process>

这是我从 railswash out 得到的回复:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:WashOut">
  <soap:Body>
    <tns:concat_response>
      <concatResponse xsi:type="tns:concatResponse">
        <result xsi:type="xsd:string">gogo</result>
      </concatResponse>
    </tns:concat_response>
  </soap:Body>
</soap:Envelope>
4

1 回答 1

0

据我所知,像 BPEL 引擎这样的工具不适用于 RPC 编码的 SOAP 消息。它们仅适用于 Document/Literal Wrapped 样式。

尝试使用 WSDL 的 Document Wrapped 样式而不是 RPC,它在wash_out 中默认使用。Document Wrapped 样式意味着您将只使用一个复杂的对象参数来进行请求和响应。我将成为您所有参数的包装器。要配置“文档”WSDL 样式,请在soap_service 声明中使用此代码:

soap_service namespace: 'urn:WashOut', wsdl_style: "document"

您还可以使用初始化程序为整个应用程序配置它。wash_out 配置选项的详细信息在这里:

https://github.com/inossidabile/wash_out#configuration

更新:支持“文档”WSDL 样式存在一个错误,我提出了一个修复它的请求请求:https ://github.com/inossidabile/wash_out/pull/186 您可以使用我的 fork,直到它合并.

更新:不幸的是,我的 PR 不足以使文档样式起作用。我们决定为我们的项目坚持使用 RPC 编码(而不是文字)风格,而不是现在投资解决这个问题。问题是文档样式并不是这个 gem 的作者的主要兴趣。所以文档样式被贡献了,但是在与标准的兼容性方面存在很多问题。

于 2015-08-04T16:11:46.293 回答