如何在BPEL流程中接收数据?

时间:2014-05-10 05:52:16

标签: wsdl bpel apache-ode

我开发了一个简单的Web服务,其中包含下一个活动:接收,分配,回复。当用户将数据发送到此进程时,将启动此服务。 但是当这个过程执行时,我需要收到一些额外的信息。为此,我使用了第二次接收活动。但是当我尝试启动此服务时,我会收到下一个错误:

ode:Fault Timeout or execution error when waiting for response to MEX {MyRoleMex#hqejbhcnphr99osb5akqhd [Client hqejbhcnphr99osb5akqhc] calling {http://middlerequester.com}MiddleRequesterService.process(...)} java.util.concurrent.TimeoutException: Message exchange org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl$ResponseFuture@62865682 timed out(120000 ms) when waiting for a response! org.apache.ode.axis2.OdeFault: Timeout or execution error when waiting for response to MEX {MyRoleMex#hqejbhcnphr99osb5akqhd [Client hqejbhcnphr99osb5akqhc] calling {http://middlerequester.com}MiddleRequesterService.process(...)} java.util.concurrent.TimeoutException: Message exchange org.apache.ode.bpel.engine.MyRoleMessageExchangeImpl$ResponseFuture@62865682 timed out(120000 ms) when waiting for a response!
 at org.apache.ode.axis2.ODEService.onAxisMessageExchange(ODEService.java:167)
 at org.apache.ode.axis2.hooks.ODEMessageReceiver.invokeBusinessLogic(ODEMessageReceiver.java:69)
 at org.apache.ode.axis2.hooks.ODEMessageReceiver.invokeBusinessLogic(ODEMessageReceiver.java:52)
 at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
 at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
 at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:173)
 at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:144)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
 at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)
 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1015)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:652)
 at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1575)
 at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1533)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

现在我不知道如何获取这些额外信息。如果有人能告诉我如何解决这个问题,我将非常感激。 下一段代码演示了我的流程定义:

<!-- MiddleRequester BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Fri May 09 15:00:10 MSK 2014 -->
<bpel:process name="MiddleRequester"
         targetNamespace="http://middlerequester.com"
         suppressJoinFailure="yes"
         xmlns:tns="http://middlerequester.com"
         xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         xmlns:ns1="http://www.w3.org/2001/XMLSchema">


    <messageExchanges> 
        <messageExchange name="receiveBuyerInformation" /> 
        <messageExchange name="receiveSellerInformation" /> 
    </messageExchanges> 


    <!-- Import the client WSDL -->
    <bpel:import location="MiddleRequesterArtifacts.wsdl" namespace="http://middlerequester.com" 
            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:MiddleRequester"
                     myRole="MiddleRequesterProvider"
                     />
    </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:MiddleRequesterRequestMessage"/>

        <!-- 
          Reference to the message that will be returned to the requester
          -->
        <bpel:variable name="output"
                  messageType="tns:MiddleRequesterResponseMessage"/>



        <bpel:variable name="temp" type="ns1:string"></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 MiddleRequester.wsdl 
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                messageExchange="receiveBuyerInformation" 
                 portType="tns:MiddleRequester"
                 operation="process" variable="input"
                 createInstance="yes"/>

        <!-- Generate reply to synchronous request -->

        <bpel:assign validate="no" name="Assign">
            <bpel:copy>
                <bpel:from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                    <![CDATA[concat("You entered: " ,$input.payload/tns:input)]]>
                </bpel:from>
                <bpel:to variable="temp"></bpel:to>
            </bpel:copy>

        </bpel:assign>
        <bpel:receive name="Receive" messageExchange="receiveSellerInformation" 
         partnerLink="client" operation="process" portType="tns:MiddleRequester" variable="input">
        </bpel:receive>

        <bpel:assign validate="no" name="Assign1">
            <bpel:copy>
                <bpel:from><bpel:literal><tns:MiddleRequesterResponse xmlns:tns="http://middlerequester.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:result>tns:result</tns:result>
</tns:MiddleRequesterResponse>
</bpel:literal></bpel:from>
                <bpel:to variable="output" part="payload"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                    <![CDATA[concat($temp ,$input.payload/tns:input)]]>
                </bpel:from>
                <bpel:to part="payload" variable="output">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:reply name="replyOutput"
                messageExchange="receiveBuyerInformation" 
               partnerLink="client"
               portType="tns:MiddleRequester"
               operation="process" 
               variable="output"
               />
    </bpel:sequence>
</bpel:process>

1 个答案:

答案 0 :(得分:1)

我在您的流程中看到了两件事:

  1. 操作process似乎被定义为双向操作。这意味着您需要有两个接收 - 回复活动对。您已添加了额外的接收,但现在原始接收的回复正在回复新接收,并且初始接收没有回复。

  2. 您需要为第二个回复使用相关集。虽然您需要了解相关性,但相关性是一个简单的主题。请参阅有关BPEL关联集的一些文档。