5 Replies Latest reply on Nov 11, 2008 12:54 AM by sw_bpel

    BPEL Problem with Fault Handler

    fabiana

      Hi, I'm trying to develop a BPEL process with fault handling. I have a web service wich unzip a file and send a fault message when cannot find the file. The wsdl of this web service is this:

      <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:schema="http://www.xxx.it/xxx/schema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.xxx.it/xxx/schema">
       <wsdl:types>
       <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.xxx.it/xxx/schema" elementFormDefault="qualified" targetNamespace="http://www.xxx.it/xxx/schema">
       <element name="UnzipXPostFileRequest">
       <complexType>
       <sequence>
       <element maxOccurs="1" minOccurs="1" name="idFile" type="long"/>
       </sequence>
       </complexType>
      
       </element>
      
       <element name="UnzipXPostFileResponse">
       <complexType>
       <sequence>
       <element maxOccurs="1" minOccurs="1" name="nomeFileDati" type="tns:TipoNomePathFile"/>
       <element maxOccurs="1" minOccurs="1" name="pathFileDati" type="tns:TipoNomePathFile"/>
       <element maxOccurs="1" minOccurs="0" name="nomeFileIndice" type="tns:TipoNomePathFile"/>
       <element maxOccurs="1" minOccurs="0" name="pathFileIndice" type="tns:TipoNomePathFile"/>
       </sequence>
      
       </complexType>
       </element>
      
       <element name="ParseXMLIndiceRequest">
       <complexType>
       <sequence>
       <element maxOccurs="1" minOccurs="1" name="idFile" type="long"/>
       <element maxOccurs="1" minOccurs="1" name="nomeFileIndice" type="tns:TipoNomePathFile"/>
       <element maxOccurs="1" minOccurs="1" name="pathFileIndice" type="tns:TipoNomePathFile"/>
      
       </sequence>
       </complexType>
       </element>
      
       <element name="ParseXMLIndiceResponse">
       <complexType>
       <sequence>
       <element maxOccurs="1" minOccurs="1" name="nomeFileIndice" type="tns:TipoNomePathFile"/>
       <element maxOccurs="1" minOccurs="1" name="pathFileIndice" type="tns:TipoNomePathFile"/>
      
       </sequence>
       </complexType>
       </element>
      
       <element name="UnzipXPostFileFault">
       <complexType>
       <sequence>
       <element name="customField" type="string"/>
       </sequence>
      
       </complexType>
       </element>
      
       <simpleType name="TipoNomePathFile">
       <annotation>
       <documentation>Definisce il nome o il percorso di un file</documentation>
       </annotation>
       <restriction base="string">
       <minLength value="1"/>
      
       <maxLength value="255"/>
       <pattern value="[a-zA-Z0-9_\\/. ]+"/>
       </restriction>
       </simpleType>
      </schema>
       </wsdl:types>
       <wsdl:message name="UnzipXPostFileRequest">
       <wsdl:part element="schema:UnzipXPostFileRequest" name="UnzipXPostFileRequest">
       </wsdl:part>
      
       </wsdl:message>
       <wsdl:message name="ParseXMLIndiceRequest">
       <wsdl:part element="schema:ParseXMLIndiceRequest" name="ParseXMLIndiceRequest">
       </wsdl:part>
       </wsdl:message>
       <wsdl:message name="UnzipXPostFileFault">
       <wsdl:part element="schema:UnzipXPostFileFault" name="UnzipXPostFileFault">
       </wsdl:part>
       </wsdl:message>
      
       <wsdl:message name="ParseXMLIndiceResponse">
       <wsdl:part element="schema:ParseXMLIndiceResponse" name="ParseXMLIndiceResponse">
       </wsdl:part>
       </wsdl:message>
       <wsdl:message name="UnzipXPostFileResponse">
       <wsdl:part element="schema:UnzipXPostFileResponse" name="UnzipXPostFileResponse">
       </wsdl:part>
       </wsdl:message>
       <wsdl:portType name="XPostWS">
      
       <wsdl:operation name="UnzipXPostFile">
       <wsdl:input message="schema:UnzipXPostFileRequest" name="UnzipXPostFileRequest">
       </wsdl:input>
       <wsdl:output message="schema:UnzipXPostFileResponse" name="UnzipXPostFileResponse">
       </wsdl:output>
       <wsdl:fault message="schema:UnzipXPostFileFault" name="UnzipXPostFileFault">
       </wsdl:fault>
       </wsdl:operation>
       <wsdl:operation name="ParseXMLIndice">
      
       <wsdl:input message="schema:ParseXMLIndiceRequest" name="ParseXMLIndiceRequest">
       </wsdl:input>
       <wsdl:output message="schema:ParseXMLIndiceResponse" name="ParseXMLIndiceResponse">
       </wsdl:output>
       </wsdl:operation>
       </wsdl:portType>
       <wsdl:binding name="XPostWSBinding" type="schema:XPostWS">
       <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <wsdl:operation name="UnzipXPostFile">
      
       <soap:operation soapAction=""/>
       <wsdl:input name="UnzipXPostFileRequest">
       <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="UnzipXPostFileResponse">
       <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="UnzipXPostFileFault">
       <soap:fault name="UnzipXPostFileFault" use="literal"/>
      
       </wsdl:fault>
       </wsdl:operation>
       <wsdl:operation name="ParseXMLIndice">
       <soap:operation soapAction=""/>
       <wsdl:input name="ParseXMLIndiceRequest">
       <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="ParseXMLIndiceResponse">
       <soap:body use="literal"/>
      
       </wsdl:output>
       </wsdl:operation>
       </wsdl:binding>
       <wsdl:service name="XPostWSService">
       <wsdl:port binding="schema:XPostWSBinding" name="XPostWSPort">
       <soap:address location="http://localhost:8080/xxxx-server/xxxxWS"/>
       </wsdl:port>
       </wsdl:service>
      </wsdl:definitions>
      


      In the BPEL code I have this inline fault handler:
       <bpws:invoke inputVariable="unzipXPostFileRequest" name="Invoke"
       operation="UnzipXPostFile"
       outputVariable="unzipXPostFileResponse"
       partnerLink="xPostWS" portType="ns0:XPostWS">
       <bpws:catch faultMessageType="ns0:UnzipXPostFileFault"
       faultName="ns0:UnzipXPostFileFault" faultVariable="unzipXPostFileFault">
       <bpws:sequence>
       <bpws:assign name="Assign2" validate="no">
       <bpws:copy>
       <bpws:from><![CDATA[concat($input.payload, "Errore")]]></bpws:from>
       <bpws:to part="payload" variable="input">
       <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpws:query>
       </bpws:to>
       </bpws:copy>
       </bpws:assign>
       </bpws:sequence>
       </bpws:catch>
       </bpws:invoke>
      


      The process is deployed and works well when there is no fault, but when the service send a fault message, I got this:

      11:31:20,107 WARN [ProxyWarnLog] Narrowing proxy to class org.jbpm.bpel.variable.def.MessageType - this operation breaks ==
      11:31:20,107 ERROR [GraphElement] action threw exception: org.jbpm.bpel.graph.exe.FaultInstance@d246ce[name={http://www.xxxx.it/xxxx/schema}UnzipXPostFileFault,message=org.jbpm.bpel.variable.exe.MessageValue@126a8dc[type=org.jbpm.bpel.variable.def.MessageType@1183a79[name={http://www.xxxx.it/xxxx/schema}UnzipXPostFileFault],parts={UnzipXPostFileFault=[UnzipXPostFileFault: null]}]]
      org.jbpm.bpel.graph.exe.BpelFaultException: org.jbpm.bpel.graph.exe.FaultInstance@d246ce[name={http://www.xxxx.it/xxxx/schema}UnzipXPostFileFault,message=org.jbpm.bpel.variable.exe.MessageValue@126a8dc[type=org.jbpm.bpel.variable.def.MessageType@1183a79[name={http://www.xxxx.it/xxxx/schema}UnzipXPostFileFault],parts={UnzipXPostFileFault=[UnzipXPostFileFault: null]}]]
      at org.jbpm.bpel.integration.client.SoapClient.call(SoapClient.java:112)
      at org.jbpm.bpel.integration.jms.JmsIntegrationService.invoke(JmsIntegrationService.java:182)
      at org.jbpm.bpel.integration.def.InvokeAction.execute(InvokeAction.java:76)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
      at org.jbpm.graph.def.Action_$$_javassist_159.execute(Action_$$_javassist_159.java)
      at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:264)
      at org.jbpm.graph.def.Node.execute(Node.java:339)
      at org.jbpm.bpel.graph.def.Activity.enter(Activity.java:110)
      at org.jbpm.graph.def.Transition.take(Transition.java:151)
      at org.jbpm.graph.def.Node.leave(Node.java:394)
      at org.jbpm.bpel.graph.def.Activity.leave(Activity.java:200)
      at org.jbpm.bpel.graph.basic.Assign.execute(Assign.java:47)
      at org.jbpm.bpel.graph.def.Activity.enter(Activity.java:110)
      at org.jbpm.graph.def.Transition.take(Transition.java:151)
      at org.jbpm.graph.def.Node.leave(Node.java:394)
      at org.jbpm.bpel.graph.def.Activity.leave(Activity.java:200)
      at org.jbpm.bpel.graph.basic.Receive.messageReceived(Receive.java:53)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
      at org.jbpm.bpel.graph.basic.Receive_$$_javassist_29.messageReceived(Receive_$$_javassist_29.java)
      at org.jbpm.bpel.integration.def.ReceiveAction.deliverMessage(ReceiveAction.java:99)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
      at org.jbpm.bpel.integration.def.ReceiveAction_$$_javassist_103.deliverMessage(ReceiveAction_$$_javassist_103.java)
      at org.jbpm.bpel.integration.jms.StartListener.deliverRequest(StartListener.java:222)
      at org.jbpm.bpel.integration.jms.StartListener.onMessage(StartListener.java:168)
      at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:682)
      at java.lang.Thread.run(Thread.java:595)


      This is the fault message that I receive:
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
       <SOAP-ENV:Header/>
       <SOAP-ENV:Body>
       <SOAP-ENV:Fault>
       <faultcode>SOAP-ENV:Server</faultcode>
       <faultstring>Server error</faultstring>
       <detail>
       <UnzipXPostFileFault xmlns="http://www.xxxx.it/xxxx/schema">
       <customField>100</customField>
       </UnzipXPostFileFault>
       </detail>
       </SOAP-ENV:Fault>
       </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      


      I'm using the JBoss 4.2.2.GA and the BPEL engine jbpm-bpel.1.1.GA To develop the web service I use Spring Web Services (first contract).
      Any ideas?
      Thank you all and sorry for the long post,
      Fabiana