BPEL を使用して単純なサービス オーケストレーションを実行しようとしています。ファイルをアップロードできる操作を備えたサービスがあり、複数のファイルをアップロードできるプロセスでそれをオーケストレーションしたいと考えています。
これを実現するために、文字列 (名前) と base64Binary (ファイルの内容) を含むカスタム要素の配列である入力変数を定義しました。
私がやろうとしているのは、それらのファイルを受け取り、すべてのファイルがアップロードされるまで繰り返す ForEach ループでアップロード サービスを呼び出すことです。
プロセスを Apache ODE に正常に展開し、WSDL2Java を使用してクライアントを生成してテストしました。問題は、サービスを呼び出すと、Axis Fault が発生することです。
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)
スタブのプロセス メソッドを呼び出した瞬間に例外がスローされます。
初期化されていない変数を使用しようとすると、通常、この失敗が発生することを読んだことがありますが、Eclipse の BPEL デザイナーを使用していて、割り当てアクティビティを追加すると、変数を初期化したい
私は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">"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>
更新:あなたのアドバイスの後、いくつかの変更を加えました。結果は次のとおりです。
<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>
ここには、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」だけです。
<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>