Apache ODE BPEL soapenv:服务器axis2ns1:selectionFailure

时间:2017-11-13 20:52:48

标签: workflow ode bpel apache-ode

我是BPEL的新手并且正在努力开始。

我创建了一个简单的If / Else工作流,但在使用eclipse web services explorer测试wsdl文件时出现以下错误:

soapenv:Server axis2ns1:selectionFailure

我对其他类似问题的理解是它可能非常简单,与if条件中的命名空间或变量名相关,但我不明白为什么,以及如何解决它。

我在Eclipse 4.7.1 Oxygen和Tomcat 8.5上使用Apache ODE 1.3.7。

这是我的工作流程设计:

workflow design

BPEL文件:

<!-- 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文件:

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

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

1 个答案:

答案 0 :(得分:1)

SelectionFailure表示找不到正在查询的xml元素。查看您的BPEL,我假设在初始化之前正在查询输出变量。

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