On 18 June 2012 18:57, giocarmine <[email protected]> wrote: > > Hello all, > > i'm trying to do a simple service orchestration using BPEL: i have a > service > with an operation that lets me to upload a file and i want to orchestrate > it > with a process that allows me to upload more than one file. > > To achieve this i defined an input variabile that is an array of custom > elements each one containing a string (the name) and a base64Binary (the > file content). > > What i'm trying to do is to receive those files and invoke the upload > service with a ForEach loop that iterates until all the files are uploaded. > > I've successfully deployed my process in Apache ODE and i've generated a > client using WSDL2Java to test it. The problem is that when i call the > service i get an 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) > > > The exception is thown in the moment i call stub's process method. > > I've read that usually you get this failure when you try to use some > variable that hasn't been initialized, but they should be, since i'm using > BPEL designer for Eclipse and when i add some assign activity it asks me if > i want to initialize the variables. I've even tried to add an Assign > activity where i assign literal values to the variable ImportPLRRequest > before copying in it an expresison value. > > I hope someone can give me some advice, or tell me if i'm doing something > stupid, since i'm quite new to BPEL :) > > Here it is my process' code: > > <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> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ In the above block, before you copy some value into "ImportPLRequest" variable's "ns1:name" element, you should initialise the "ImportPLRequest" variable. You have only provided the WSDL for the BPEL process, but this variable is created out of a message in your partner service's WSDL. You can refer [1] as a reference for variable initialisation. See the first copy statement. [1] - https://svn.wso2.org/repos/wso2/carbon/platform/trunk/products/bps/modules/samples/product/src/main/resources/bpel/2.0/CreditRating/CreditRating.bpel Thanks, Waruna > <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> > > > Here there is also the WSDL file generated by Eclipse BPEL Designer: > > > <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> > > > I really hope someone can give me some advice! > Thank you in advance :) > -- > View this message in context: > http://old.nabble.com/selectionFault-on-a-BPEL-process-tp34029862p34029862.html > Sent from the Apache Ode User mailing list archive at Nabble.com. > > -- ----------------------------------------------------- Regards, Waruna Ranasinghe www.wso2.com - "Lean . Enterprise . Middleware" blog: http://warunapw.blogspot.com twitter: http://twitter.com/warunapww http://lk.linkedin.com/in/waruna www.facebook.com/waruna.ranasinghe
