Search code examples
workflowodebpelapache-ode

Apache ODE BPEL soapenv:Server axis2ns1:selectionFailure


I am new to BPEL and struggling to get started.

I created a simple If/Else workflow, but getting the following error when I am testing the wsdl file with eclipse web services explorer:

soapenv:Server axis2ns1:selectionFailure

My understanding from other similar questions is its probably something very simple and related to namespace or variable name in the if condition, but I can't understand why, and how to solve it.

I am using Apache ODE 1.3.7 on Eclipse 4.7.1 Oxygen and Tomcat 8.5.

This is my workflow design:

workflow design

BPEL FILE:

<!-- Flow1 BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Mon Nov 13 23:18:38 AST 2017 -->
<bpel:process name="Flow1"
         targetNamespace="http://Flow1"
         suppressJoinFailure="yes"
         xmlns:tns="http://Flow1"
         xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
         >

    <!-- Import the client WSDL -->
    <bpel:import location="Flow1Artifacts.wsdl" namespace="http://Flow1" 
            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:Flow1"
                     myRole="Flow1Provider"
                     />
    </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:Flow1RequestMessage"/>

        <!-- 
          Reference to the message that will be returned to the requester
          -->
        <bpel:variable name="output"
                  messageType="tns:Flow1ResponseMessage"/>
    </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 Flow1.wsdl 
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                 portType="tns:Flow1"
                 operation="process" variable="input"
                 createInstance="yes"/>

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



        <bpel:if name="If">
            <bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[$input.payload/tns:input="John"]]></bpel:condition>
        <bpel:sequence name="Sequence">
                <bpel:assign validate="no" name="Assign">
                    <bpel:copy>
                        <bpel:from>
                            <bpel:literal xml:space="preserve">Hi John</bpel:literal>
                        </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" partnerLink="client" portType="tns:Flow1" operation="process" variable="output" />

            </bpel:sequence>
            <bpel:else>
                <bpel:sequence name="Sequence1">
                    <bpel:assign validate="no" name="Assign1">
                        <bpel:copy>
                            <bpel:from>
                                <bpel:literal xml:space="preserve">Not john</bpel:literal>
                            </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="Reply" partnerLink="client" operation="process" portType="tns:Flow1" variable="output"></bpel:reply>
                </bpel:sequence>
            </bpel:else>

        </bpel:if>
    </bpel:sequence>
</bpel:process>

WSDL FILE:

<?xml version="1.0"?>
<definitions name="Flow1"
        targetNamespace="http://Flow1"
        xmlns:tns="http://Flow1"
        xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
        >

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     TYPE DEFINITION - List of types participating in this BPEL process 
     The BPEL Designer will generate default request and response types
     but you can define or import any XML Schema type and use them as part 
     of the message types.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <types>
        <schema attributeFormDefault="unqualified" elementFormDefault="qualified" 
                targetNamespace="http://Flow1" 
                xmlns="http://www.w3.org/2001/XMLSchema">

            <element name="Flow1Request">
                <complexType>
                    <sequence>
                        <element name="input" type="string"/>
                    </sequence>
                </complexType>
            </element>

            <element name="Flow1Response">
                <complexType>
                    <sequence>
                        <element name="result" type="string"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
    </types>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     MESSAGE TYPE DEFINITION - Definition of the message types used as 
     part of the port type defintions
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <message name="Flow1RequestMessage">
        <part name="payload" element="tns:Flow1Request"/>
    </message>
    <message name="Flow1ResponseMessage">
        <part name="payload" element="tns:Flow1Response"/>
    </message>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PORT TYPE DEFINITION - A port type groups a set of operations into
     a logical service unit.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    

    <!-- portType implemented by the Flow1 BPEL process -->
    <portType name="Flow1">
        <operation name="process">
            <input  message="tns:Flow1RequestMessage" />
            <output message="tns:Flow1ResponseMessage"/>
        </operation>
    </portType>   
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PARTNER LINK TYPE DEFINITION
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->    
    <plnk:partnerLinkType name="Flow1">
        <plnk:role name="Flow1Provider" portType="tns:Flow1"/>
    </plnk:partnerLinkType>


<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     BINDING DEFINITION - Defines the message format and protocol details
     for a web service.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <binding name="Flow1Binding" type="tns:Flow1">
        <soap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="process">
            <soap:operation
                soapAction="http://Flow1/process" />
            <input>
                <soap:body use="literal" />
            </input>
            <output>
                <soap:body use="literal" />
            </output>
        </operation>
    </binding>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     SERVICE DEFINITION - A service groups a set of ports into
     a service unit.
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
    <service name="Flow1Service">
        <port name="Flow1Port" binding="tns:Flow1Binding">
            <soap:address location="http://localhost:8084/ode/processes/Flow1" />
        </port>
    </service>
</definitions>

and Deploy.xml

<?xml version="1.0" encoding="UTF-8"?>
<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:Flow1="http://Flow1">
  <process name="Flow1:Flow1">
    <active>true</active>
    <retired>false</retired>
    <process-events generate="all"/>
    <provide partnerLink="client">
      <service name="Flow1:Flow1Service" port="Flow1Port"/>
    </provide>
  </process>
</deploy>

Solution

  • SelectionFailure indicates that xml element that is being queried is not found. Looking at your BPEL, I assume the output variable is being queried before initializing it.

    Initialize the output variable before the if/else:

    <bpel:assign validate="no" name="initialize">
        <bpel:copy>
            <bpel:from>
                <bpel:literal xml:space="preserve">
                    <tns:Flow1Response xmlns:tns="http://Flow1"><tns:result /></tns:Flow1Response>
                </bpel:literal>
            </bpel:from>
            <bpel:to part="payload" variable="output" />
        </bpel:copy>
    </bpel:assign>