Web services BPEL流程上的selectionFault

Web services BPEL流程上的selectionFault,web-services,axis2,bpel,apache-ode,Web Services,Axis2,Bpel,Apache Ode,我正在尝试使用BPEL进行一个简单的服务编排:我有一个服务,它的操作允许我上传一个文件,我想用一个允许我上传多个文件的流程来编排它 为了实现这一点,我定义了一个输入变量,它是一个自定义元素数组,每个元素包含一个字符串(名称)和一个base64Binary(文件内容) 我试图做的是接收这些文件并使用ForEach循环调用upload服务,该循环将迭代,直到所有文件都被上传 我已经成功地在ApacheODE中部署了我的进程,并使用WSDL2Java生成了一个客户端来测试它。 问题是,当我调用该服务时

我正在尝试使用BPEL进行一个简单的服务编排:我有一个服务,它的操作允许我上传一个文件,我想用一个允许我上传多个文件的流程来编排它

为了实现这一点,我定义了一个输入变量,它是一个自定义元素数组,每个元素包含一个字符串(名称)和一个base64Binary(文件内容)

我试图做的是接收这些文件并使用ForEach循环调用upload服务,该循环将迭代,直到所有文件都被上传

我已经成功地在ApacheODE中部署了我的进程,并使用WSDL2Java生成了一个客户端来测试它。 问题是,当我调用该服务时,我遇到了Axis故障:

Exception in thread "main" org.apache.axis2.AxisFault: axis2ns75:selectionFailure
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at _import.invocation.ws.ImportOrchestrationStub.process(ImportOrchestrationStub.java:182)
at it.italsystem.client.Client.main(Client.java:58)
当我调用stub的process方法时,thown是个例外

我已经读到,当您尝试使用一些尚未初始化的变量时,通常会遇到这种失败,但它们应该是,因为我正在使用BPEL designer for Eclipse,并且当我添加一些分配活动时,它会询问我是否要初始化变量

我希望有人能给我一些建议,或者告诉我我是否在做一些愚蠢的事情,因为我对BPEL很陌生:)

这是我的流程代码:

<bpel:process name="ImportOrchestration"
     targetNamespace="http://ws.invocation.import"
     suppressJoinFailure="yes"
     xmlns:tns="http://ws.invocation.import"
     xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
     xmlns:ns1="http://services.italsystem.it">

<!-- Import the client WSDL -->
<!-- <bpel:import importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import> -->
<bpel:import namespace="http://services.italsystem.it" location="ImportModule.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="ImportOrchestrationArtifacts.wsdl" namespace="http://ws.invocation.import" 
        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:ImportOrchestration"
                 myRole="ImportOrchestrationProvider"
                 />

    <bpel:partnerLink name="ImportPL" partnerLinkType="tns:ImportType" partnerRole="ImportRole"></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:ImportOrchestrationRequestMessage"/>

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

    <bpel:variable name="ImportPLRequest" element="ns1:importSingleFile"/>
    <bpel:variable name="ImportPLResponse" element="ns1:importFileResponse"/>          

</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 ImportOrchestration.wsdl 
         -->
    <bpel:receive name="receiveInput" partnerLink="client" portType="tns:ImportOrchestration" operation="process" variable="input" createInstance="yes" />

    <!-- Generate reply to synchronous request -->
    <bpel:forEach parallel="no" counterName="Counter" name="ForEach" xmlns:http="urn:http:namesapce">
        <bpel:startCounterValue>1</bpel:startCounterValue>
        <bpel:finalCounterValue>
            <![CDATA[count($input.payload/tns:file/tns:name)]]>
        </bpel:finalCounterValue>
        <bpel:scope>
            <bpel:sequence>
                <bpel:assign validate="no" name="Assign">
                    <bpel:copy>
                        <bpel:from>
                            <![CDATA[$input.payload/tns:file/tns:name]]>
                        </bpel:from>
                        <bpel:to variable="ImportPLRequest">
                            <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:name]]></bpel:query>
                        </bpel:to>
                    </bpel:copy>
                    <bpel:copy>
                        <bpel:from>
                            <![CDATA[$input.payload/tns:file/tns:content]]>
                        </bpel:from>
                        <bpel:to variable="ImportPLRequest">
                            <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:content]]></bpel:query>
                        </bpel:to>
                    </bpel:copy>
                </bpel:assign>
                <bpel:invoke name="Invoke" partnerLink="ImportPL" operation="importSingleFile" portType="ns1:ImportServicePortType" inputVariable="ImportPLRequest1" outputVariable="ImportPLResponse1"></bpel:invoke>

            </bpel:sequence>
            <bpel:variables>
                <bpel:variable name="ImportPLResponse1" messageType="ns1:importSingleFileResponse"></bpel:variable>
                <bpel:variable name="ImportPLRequest1" messageType="ns1:importSingleFileRequest"></bpel:variable>
            </bpel:variables>
        </bpel:scope>
    </bpel:forEach>

    <bpel:assign validate="no" name="Assign1">
        <bpel:copy>
            <bpel:from>
                <bpel:literal xml:space="preserve">&quot;Done!&quot;</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:ImportOrchestration" operation="process" variable="output" />

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

1.
“完成了!”
更新:根据您的建议,我做了一些更改,结果如下:

<bpel:process name="ImportOrchestration"
     targetNamespace="http://ws.invocation.import"
     suppressJoinFailure="yes"
     xmlns:tns="http://ws.invocation.import"
     xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
     xmlns:ns1="http://services.italsystem.it">

<bpel:import namespace="http://services.italsystem.it" location="ImportModule.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="ImportOrchestrationArtifacts.wsdl" namespace="http://ws.invocation.import" 
        importType="http://schemas.xmlsoap.org/wsdl/" />

<bpel:partnerLinks>
    <bpel:partnerLink name="client"
                 partnerLinkType="tns:ImportOrchestration"
                 myRole="ImportOrchestrationProvider"
                 />

    <bpel:partnerLink name="ImportPL" partnerLinkType="tns:ImportType" partnerRole="ImportRole"></bpel:partnerLink>
</bpel:partnerLinks>

<bpel:variables>
    <bpel:variable name="input"
              messageType="tns:ImportOrchestrationRequestMessage"/>
    <bpel:variable name="output"
              messageType="tns:ImportOrchestrationResponseMessage"/>
    <bpel:variable name="ImportPLResponse" messageType="ns1:importSingleFileResponse"></bpel:variable>
    <bpel:variable name="ImportPLRequest" messageType="ns1:importSingleFileRequest"></bpel:variable>                  
</bpel:variables>

<bpel:sequence name="main">
    <bpel:receive name="receiveInput" partnerLink="client" portType="tns:ImportOrchestration" operation="process" variable="input" createInstance="yes" />

    <bpel:forEach parallel="no" counterName="Counter" name="ForEach" xmlns:http="urn:http:namesapce">
        <bpel:startCounterValue>1</bpel:startCounterValue>
        <bpel:finalCounterValue>
            <![CDATA[count($input.payload/tns:file/tns:name)]]>
        </bpel:finalCounterValue>
        <bpel:scope>
            <bpel:sequence>
                <bpel:assign validate="no" name="InitializeAssign">
                    <bpel:copy>
                        <bpel:from>
                            <bpel:literal xml:space="preserve">0</bpel:literal>
                        </bpel:from>
                        <bpel:to part="parameters" variable="ImportPLRequest">
                            <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:name]]></bpel:query>
                        </bpel:to>
                    </bpel:copy>
                    <bpel:copy>
                        <bpel:from>
                            <bpel:literal xml:space="preserve">0</bpel:literal>
                        </bpel:from>
                        <bpel:to part="parameters" variable="ImportPLRequest">
                            <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:content]]></bpel:query>
                        </bpel:to>
                    </bpel:copy>
                </bpel:assign>
                <bpel:assign validate="no" name="Assign">

                    <bpel:copy>
                        <bpel:from>
                            <![CDATA[$input.payload/tns:file/tns:name]]>
                        </bpel:from>
                        <bpel:to variable="ImportPLRequest">
                            <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:name]]></bpel:query>
                        </bpel:to>
                    </bpel:copy>
                    <bpel:copy>
                        <bpel:from>
                            <![CDATA[$input.payload/tns:file/tns:content]]>
                        </bpel:from>
                        <bpel:to variable="ImportPLRequest">
                            <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns1:content]]></bpel:query>
                        </bpel:to>
                    </bpel:copy>
                </bpel:assign>
                <bpel:invoke name="Invoke" partnerLink="ImportPL" operation="importSingleFile" portType="ns1:ImportServicePortType" inputVariable="ImportPLRequest" outputVariable="ImportPLResponse"></bpel:invoke>

            </bpel:sequence>
        </bpel:scope>
    </bpel:forEach>

    <bpel:assign validate="no" name="Assign1">

        <bpel:copy>
            <bpel:from>
                <bpel:literal xml:space="preserve">DONE</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:ImportOrchestration" operation="process" variable="output" />

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

1.
0
0
完成
这里还有Eclipse BPEL Designer生成的WSDL文件:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.invocation.import" xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop" xmlns:wsdl="http://services.italsystem.it" name="ImportOrchestration" targetNamespace="http://ws.invocation.import">

<plnk:partnerLinkType name="ImportType">
<plnk:role name="ImportRole" portType="wsdl:ImportServicePortType"/>
</plnk:partnerLinkType>
<import location="ImportModule.wsdl" namespace="http://services.italsystem.it"/>
<types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.invocation.import">

        <element name="ImportOrchestrationRequest" type="tns:ImportOrchestrationReqType">
        </element>

        <element name="singleEntry">
            <complexType>
                <sequence>
                    <element minOccurs="0" name="name" nillable="true" type="string"/>
                    <element minOccurs="0" name="content" nillable="true" type="base64Binary"/>
                </sequence>
            </complexType>
        </element>

        <element name="ImportOrchestrationResponse">
            <complexType>
                <sequence>
                    <element name="result" type="string"/>
                </sequence>
            </complexType>
        </element>

        <complexType name="ImportOrchestrationReqType">
            <sequence minOccurs="1" maxOccurs="unbounded">
                <element name="file" type="tns:SingleFile"></element>
            </sequence>
        </complexType>

        <complexType name="SingleFile">
            <sequence>
                <element name="name" type="string"></element>
                <element name="content" type="base64Binary"></element>
            </sequence>
        </complexType>
    </schema>
</types>


<message name="ImportOrchestrationRequestMessage">
    <part name="payload" element="tns:ImportOrchestrationRequest"/>
</message>
<message name="ImportOrchestrationResponseMessage">
    <part element="tns:ImportOrchestrationResponse" name="payload"/>
</message>

<portType name="ImportOrchestration">
    <operation name="process">
        <input message="tns:ImportOrchestrationRequestMessage"/>
        <output message="tns:ImportOrchestrationResponseMessage"/>
    </operation>
</portType>   

<plnk:partnerLinkType name="ImportOrchestration">
    <plnk:role name="ImportOrchestrationProvider" portType="tns:ImportOrchestration"/>
</plnk:partnerLinkType>

<binding name="ImportOrchestrationBinding" type="tns:ImportOrchestration">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="process">
        <soap:operation soapAction="http://ws.invocation.import/process"/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>

<service name="ImportOrchestration">
    <port binding="tns:ImportOrchestrationBinding" name="ImportOrchestrationPort">
        <soap:address location="http://localhost:8080/ode/processes/ImportOrchestration"/>
    </port>
</service>
</definitions>

最后是流程使用的服务的WSDL。它有2个操作,但流程使用的唯一操作是“importFile”


进口服务

查看BPEL文件,我可以看到由于某种原因,您没有初始化
foreach
中的“
ImportPLRequest
”变量。您只是将值复制到变量中,而没有正确的初始化逻辑

添加流程的WSDL后编辑。
查看更新的BPEL文件中的第一个copy语句。 在将某些值复制到“
ImportPLRequest”之前<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://services.italsystem.it" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax23="http://exceptions.italsystem.it/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://services.italsystem.it">
<wsdl:documentation>ImportService</wsdl:documentation>
<wsdl:types>
    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://exceptions.italsystem.it/xsd">

        <xs:complexType name="ServiceException">
            <xs:complexContent>
                <xs:extension base="xs:anyType" />
            </xs:complexContent>
        </xs:complexType>   

    </xs:schema>
    <xs:schema xmlns:ax24="http://exceptions.italsystem.it/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://services.italsystem.it">
        <xs:import namespace="http://exceptions.italsystem.it/xsd"/>
        <xs:element name="ImportServiceServiceException">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="ServiceException" nillable="true" type="ax23:ServiceException"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="importFile">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="dh" nillable="true" type="xs:base64Binary"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="importFileResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="importSingleFile">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="content" nillable="true" type="xs:base64Binary"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="importSingleFileResponse">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>
</wsdl:types>
<wsdl:message name="importFileRequest">
    <wsdl:part name="parameters" element="ns:importFile"/>
</wsdl:message>
<wsdl:message name="importFileResponse">
    <wsdl:part name="parameters" element="ns:importFileResponse"/>
</wsdl:message>
<wsdl:message name="ImportServiceServiceException">
    <wsdl:part name="parameters" element="ns:ImportServiceServiceException"/>
</wsdl:message>
<wsdl:message name="importSingleFileRequest">
    <wsdl:part name="parameters" element="ns:importSingleFile"/>
</wsdl:message>
<wsdl:message name="importSingleFileResponse">
    <wsdl:part name="parameters" element="ns:importSingleFileResponse"/>
</wsdl:message>
<wsdl:portType name="ImportServicePortType">
    <wsdl:operation name="importFile">
        <wsdl:input message="ns:importFileRequest" wsaw:Action="urn:importFile"/>
        <wsdl:output message="ns:importFileResponse" wsaw:Action="urn:importFileResponse"/>
        <wsdl:fault message="ns:ImportServiceServiceException" name="ImportServiceServiceException" wsaw:Action="urn:importFileImportServiceServiceException"/>
    </wsdl:operation>
    <wsdl:operation name="importSingleFile">
        <wsdl:input message="ns:importSingleFileRequest" wsaw:Action="urn:importSingleFile"/>
        <wsdl:output message="ns:importSingleFileResponse" wsaw:Action="urn:importSingleFileResponse"/>
        <wsdl:fault message="ns:ImportServiceServiceException" name="ImportServiceServiceException" wsaw:Action="urn:importSingleFileImportServiceServiceException"/>
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ImportServiceSoap11Binding" type="ns:ImportServicePortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="importFile">
        <soap:operation soapAction="urn:importFile" style="document"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="ImportServiceServiceException">
            <soap:fault use="literal" name="ImportServiceServiceException"/>
        </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="importSingleFile">
        <soap:operation soapAction="urn:importSingleFile" style="document"/>
        <wsdl:input>
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="ImportServiceServiceException">
            <soap:fault use="literal" name="ImportServiceServiceException"/>
        </wsdl:fault>
    </wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ImportServiceSoap12Binding" type="ns:ImportServicePortType">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <wsdl:operation name="importFile">
        <soap12:operation soapAction="urn:importFile" style="document"/>
        <wsdl:input>
            <soap12:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap12:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="ImportServiceServiceException">
            <soap12:fault use="literal" name="ImportServiceServiceException"/>
        </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="importSingleFile">
        <soap12:operation soapAction="urn:importSingleFile" style="document"/>
        <wsdl:input>
            <soap12:body use="literal"/>
        </wsdl:input>
        <wsdl:output>
            <soap12:body use="literal"/>
        </wsdl:output>
        <wsdl:fault name="ImportServiceServiceException">
            <soap12:fault use="literal" name="ImportServiceServiceException"/>
        </wsdl:fault>
    </wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ImportServiceHttpBinding" type="ns:ImportServicePortType">
    <http:binding verb="POST"/>
    <wsdl:operation name="importFile">
        <http:operation location="importFile"/>
        <wsdl:input>
            <mime:content type="application/xml" part="parameters"/>
        </wsdl:input>
        <wsdl:output>
            <mime:content type="application/xml" part="parameters"/>
        </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="importSingleFile">
        <http:operation location="importSingleFile"/>
        <wsdl:input>
            <mime:content type="application/xml" part="parameters"/>
        </wsdl:input>
        <wsdl:output>
            <mime:content type="application/xml" part="parameters"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="ImportService">
    <wsdl:port name="ImportServiceHttpSoap11Endpoint" binding="ns:ImportServiceSoap11Binding">
        <soap:address location="http://localhost:8080/axis2/services/ImportService.ImportServiceHttpSoap11Endpoint/"/>
    </wsdl:port>
    <wsdl:port name="ImportServiceHttpSoap12Endpoint" binding="ns:ImportServiceSoap12Binding">
        <soap12:address location="http://localhost:8080/axis2/services/ImportService.ImportServiceHttpSoap12Endpoint/"/>
    </wsdl:port>
    <wsdl:port name="ImportServiceHttpEndpoint" binding="ns:ImportServiceHttpBinding">
        <http:address location="http://localhost:8080/axis2/services/ImportService.ImportServiceHttpEndpoint/"/>
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>