wsdlbpelapache-ode

how to receive data within BPEL process?


I developed a simple web service which contains next activities: receive, assign, reply. This service launched when the user sends data to this process. But when this process is executes I need to receive some additional information. For this purpose i used the second receive activity. But when I trying to launch this service I get next error:

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)

And now I don't know how to get this additional information. I will be very grateful if someone could tell me how to solve this issue. Next piece of code demonstrates my process definition:

<!-- 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>

Solution

  • There are two things that I see in your process:

    1. The operation process seems to be defined as a two-way operation. That means that you need to have two receive-reply activity pairs. You have added an additional receive but now the reply for the original receive is replying to the new one and the initiating receive has no reply.

    2. You will need to use a correlation set for the second reply. Correlation is an easy topic although you need to learn it. Please see some documentation about BPEL Correlation Sets.