6 Replies Latest reply on Jul 20, 2006 4:52 PM by Jiehuan Li

    How to use faultVariable in fault handler?

    Jiehuan Li Newbie

      In jbpm bpel 1.1 beta 1, I am trying to catch a fault thrown by a web service, and then reply the client with fault message that contains the fault code from the originating web service. Below is my fault handler code:

       <faultHandlers>
       <catch faultName="svc:JSR181WebServiceException" faultVariable="svcFlt" faultMessageType="svc:JSR181WebServiceException">
       <sequence>
       <assign name="copyStep2Fault">
       <copy>
       <from variable="svcFlt" part="JSR181WebServiceException" query="/JSR181WebServiceException/svc:code"/>
       <to variable="operationFlt" part="detail"/>
       </copy>
       </assign>
       <reply operation="connect2" partnerLink="jbpmbpelRelation" portType="jbpmbpel:jbpmbpelFrontEnd"
       variable="operationFlt" faultName="jbpmbpel:step2Fault" />
       </sequence>
       </catch>
       </faultHandlers>
      


      I am getting the following exception when I try to deploy the definition:

      10:27:58,970 ERROR [ProblemHandler] jbpmbpel.bpel(34) cvc-complex-type.3.2.2: Attribute 'faultMessageType' is not allowed to appear in element 'catch'.
      10:27:59,010 ERROR [[DeployServlet]] Servlet.service() for servlet DeployServlet threw exception
      org.jbpm.jpdl.JpdlException: [[ERROR] jbpmbpel.bpel(34) cvc-complex-type.3.2.2: Attribute 'faultMessageType' is not allowed to appear in element 'catch'.]
       at org.jbpm.jpdl.par.ProcessArchive.parseProcessDefinition(ProcessArchive.java:84)
       at org.jbpm.bpel.web.deploy.DeployServlet.doGet(DeployServlet.java:49)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      


      I found both bpel_1_1.xsd and bpel_2_0.xsd in the package. Apparently 1.1 doesn't support faultMessageType in catch but 2.0 does. So I guess my question is how do I accomplish what I am trying to do using 1.1? Or what do I need to do to make jboss jbpm bpel 1.1 beta 1 to use 2.0?

      Jiehuan

        • 1. Re: How to use faultVariable in fault handler?
          Jiehuan Li Newbie

          Any help would be appreciated. I really need to get this to work. Thanks.

          • 2. Re: How to use faultVariable in fault handler?
            Alejandro Guizar Master

            In BPEL 1.1, the fault variable is not local to the fault handler; it references a variable in the enclosing scope. That is why you don't see a faultMessageType attribute there.

            If you want a document to be parsed under 2.0 rules, change the namespace of your BPEL elements from

            http://schemas.xmlsoap.org/ws/2003/03/business-process/

            to
            http://schemas.xmlsoap.org/ws/2004/03/business-process/


            • 3. Re: How to use faultVariable in fault handler?
              Jiehuan Li Newbie

              Alex,

              Thanks for the reply. I tried defining the variable in the enclosing scope and then referencing it in the faultHandler by faultVariable, but I ran into a dilemma. If I try to deploy the definition with the faultVariable specified in the faultHandler, I am getting the following exception:

              10:05:41,967 ERROR [[DeployServlet]] Servlet.service() for servlet DeployServlet threw exception
              org.jbpm.jpdl.JpdlException: [[ERROR] jbpmbpel.bpel catch must specify either a faultMessageType or a faultElement [/process/faultHandlers/catch]]
               at org.jbpm.jpdl.par.ProcessArchive.parseProcessDefinition(ProcessArchive.java:84)
               at org.jbpm.bpel.web.deploy.DeployServlet.doGet(DeployServlet.java:49)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Thread.java:595)
              


              Then I added 'faultElement' in the 'catch', I am getting the following exception:
              09:28:51,999 ERROR [[DeployServlet]] Servlet.service() for servlet DeployServlet threw exception
              org.jbpm.jpdl.JpdlException: [[ERROR] jbpmbpel.bpel(36) cvc-complex-type.3.2.2: Attribute 'faultElement' is not allowed to appear in element 'catch'.]
               at org.jbpm.jpdl.par.ProcessArchive.parseProcessDefinition(ProcessArchive.java:84)
               at org.jbpm.bpel.web.deploy.DeployServlet.doGet(DeployServlet.java:49)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Thread.java:595)
              


              Below is my code:

              <?xml version="1.0" encoding="UTF-8"?>
              <process name="jbpmbpelFrontEnd" targetNamespace="com:vizuri:bpel:jbpmbpel"
               xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
               xmlns:tns="com:vizuri:bpel:jbpmbpel" xmlns:jbpmbpel="com:vizuri:bpel:jbpmbpel" xmlns:typ="com:vizuri:bpel:types"
               xmlns:svc="http://webservice.vizuri.com/jaws" xmlns:svc2="http://webservice.vizuri.com/jaws"
               xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
               http://schemas.xmlsoap.org/ws/2003/03/business-process/">
              
               <variables>
               <variable name="operationFlt" messageType="jbpmbpel:operationFault" />
               <variable name="svcFlt" element="svc:JSR181WebServiceException" />
               </variables>
              <faultHandlers>
               <catch faultName="svc:JSR181WebServiceException" faultVariable="svcFlt">
               <sequence>
               <assign name="copyStep2Fault">
               <copy>
               <from variable="svcFlt" query="/JSR181WebServiceException/svc:code"/>
               <to variable="operationFlt" part="detail"/>
               </copy>
               </assign>
               <reply operation="connect2" partnerLink="jbpmbpelRelation" portType="jbpmbpel:jbpmbpelFrontEnd"
               variable="operationFlt" faultName="jbpmbpel:step2Fault" />
               </sequence>
               </catch>
               </faultHandlers>
              </process>
              


              I understand that adding 'faultElement' in catch causes problem because bpel 1.1 schema doesn't allow it, but why do I get the first exception when I don't have faultElement or faultMessageType in catch?

              Jiehuan

              • 4. Re: How to use faultVariable in fault handler?
                Jiehuan Li Newbie

                Any pointers would be appreciated! Thanks.

                • 5. Re: How to use faultVariable in fault handler?
                  Alejandro Guizar Master

                  I just reviewed the BPEL reader and it does not contain logic to parse 1.1 fault handlers, even tough the execution logic deals with them property. Please open a JIRA issue.