You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by kodeninja <ko...@gmail.com> on 2009/07/29 16:11:06 UTC

How to use the element in BPEL?

Howdy,

I want to understand the usage of the "catch" construct in BPEL 2.0. Are
there any good tutorials that explain its typical usage?

Consider the catch block below:

<catch faultName="HorribleFault" faultType="ns1:HorribleFault"
faultVariable="HorribleFaultVar">
</catch>

Here, does HorribleFaultVar need to be of type ns1:HorribleFault? Also, what
are the generic properties of HorribleFaultVar that will be available? Like,
how do I access the actual error message, error code if any, from this
variable?

Thanks,
-Kodeninja
 
-- 
View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24719833.html
Sent from the Apache Ode User mailing list archive at Nabble.com.


Re: How to use the element in BPEL?

Posted by "Ford, Mark" <ma...@ll.mit.edu>.
Your bpel was using a catchAll. You need to define a catch that is specific to the fault you're trying to catch. There's a primer on bpel here:

http://docs.oasis-open.org/wsbpel/2.0/Primer/wsbpel-v2.0-Primer.pdf


On 8/4/09 9:20 PM, "Augusto Diaz" <ad...@gmail.com> wrote:

Hi Mark,

I cannot access the contents of the fault message. I tried in several
ways but I without succeded. Could you please help me?

Im sending you my BPEL file and the WSDL that defines the fault.

Or if you have a link with an example it would be excellent.

Thanks in advance.



2009/7/30 Ford, Mark <ma...@ll.mit.edu>:
> There are three types of faults:
>
>  *   standard BPEL faults like bpel:selectionFailure. These typically indicate a problem in your process where you've not implemented something correctly
>  *   custom faults that you throw internally with the bpel:throw activity. This can be any type of xml data you want.
>  *   faults resulting from web service invokes. The fault will be defined on the operation that you're invoking. An operation may define multiple faults.
>
> It sounds like you're asking how to access the SOAP fault from an invoke. The short answer is that there is nothing in the spec about SOAP and there are no built in functions to access the faultCode, faultActor, or faultString.
>
> The typical use case here is to define a catch for each fault that is defined on the operation you're invoking. Make sure the name and the fault message/element matches what's defined in the WSDL for the operation. Each catch defined in this way serves as a declaration of a variable of that message/element that is scoped to that catch. When the catch executes, you can access the contents of the fault message/element just like any other variable. Keep in mind, the contents of this variable will be limited to what's defined in the WSDL. If you're familiar with SOAP, then it's probably the first child element of the fault detail element.
>
> On 7/30/09 3:11 AM, "kodeninja" <ko...@gmail.com> wrote:
>
>
>
> Thanks for the pointer, Nelson. However, I'm still not clear on how to catch
> hold of the actual exception trace/error code etc from the fault variable.
> How to access that?
>
> -Kodeninja
> --
> View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24733273.html
> Sent from the Apache Ode User mailing list archive at Nabble.com.
>
>
>
>
>
> --
> Mark Ford
> MIT Lincoln Laboratory
> 244 Wood Street
> Lexington MA 02420
> (781) 981-1843
>



--
Atentamente

L.I. José Augusto Díaz Noriega




--
Mark Ford
MIT Lincoln Laboratory
244 Wood Street
Lexington MA 02420
(781) 981-1843

Re: How to use the element in BPEL?

Posted by Augusto Diaz <ad...@gmail.com>.
Hi Mark,

I cannot access the contents of the fault message. I tried in several
ways but I without succeded. Could you please help me?

Im sending you my BPEL file and the WSDL that defines the fault.

Or if you have a link with an example it would be excellent.

Thanks in advance.



2009/7/30 Ford, Mark <ma...@ll.mit.edu>:
> There are three types of faults:
>
>  *   standard BPEL faults like bpel:selectionFailure. These typically indicate a problem in your process where you've not implemented something correctly
>  *   custom faults that you throw internally with the bpel:throw activity. This can be any type of xml data you want.
>  *   faults resulting from web service invokes. The fault will be defined on the operation that you're invoking. An operation may define multiple faults.
>
> It sounds like you're asking how to access the SOAP fault from an invoke. The short answer is that there is nothing in the spec about SOAP and there are no built in functions to access the faultCode, faultActor, or faultString.
>
> The typical use case here is to define a catch for each fault that is defined on the operation you're invoking. Make sure the name and the fault message/element matches what's defined in the WSDL for the operation. Each catch defined in this way serves as a declaration of a variable of that message/element that is scoped to that catch. When the catch executes, you can access the contents of the fault message/element just like any other variable. Keep in mind, the contents of this variable will be limited to what's defined in the WSDL. If you're familiar with SOAP, then it's probably the first child element of the fault detail element.
>
> On 7/30/09 3:11 AM, "kodeninja" <ko...@gmail.com> wrote:
>
>
>
> Thanks for the pointer, Nelson. However, I'm still not clear on how to catch
> hold of the actual exception trace/error code etc from the fault variable.
> How to access that?
>
> -Kodeninja
> --
> View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24733273.html
> Sent from the Apache Ode User mailing list archive at Nabble.com.
>
>
>
>
>
> --
> Mark Ford
> MIT Lincoln Laboratory
> 244 Wood Street
> Lexington MA 02420
> (781) 981-1843
>



-- 
Atentamente

L.I. José Augusto Díaz Noriega

Re: How to use the element in BPEL?

Posted by "Ford, Mark" <ma...@ll.mit.edu>.
The output variable will not get initialized by the invoke if it faults.

I'm not sure what you mean by "fault string" - again, it sounds like a SOAP term. WS-BPEL gives you access to the fault message (as in wsdl:message) or fault element (as in the element defined in the wsdl:message/wsdl:part for the wsdl:fault), depending on how you define the catch. I suggest you read through the WSDL spec to get a better understanding of how faults are defined on operations. WSDL relies on XSD to define the structure of the messages and faults it sends and receives. If you want your process to be able to get a stacktrace or error string, then you'll need to have the fault modeled to contain the string somewhere in its contents. For example, something like this:

<ns:invalidOrderFault ...>
   <ns:message>Order was invalid due to errors in one or more fields. Please correct and resubmit</ns:message>
   <ns:exception> ... Some big stacktrace </ns:exception>
   <ns:errorFields>
      <ns:field name="sku">Stock number not found in inventory</ns:field>
      ...
   </ns:errorFields>
</ns:invalidOrderFault>




On 7/31/09 2:52 AM, "kodeninja" <ko...@gmail.com> wrote:



Hi Mark,

Yes, this is exactly what I'm looking for. Just for clarity, if I invoke an
operation that has both input and output variables, and if it throws an
exception, then the output variable would be null, right? And if I'll be
able to access the exception/fault variable only in the specific catch
block, would I be able to get the actual fault string there?

-Kodeninja


mark.ford wrote:
>
> It sounds like you're asking how to access the SOAP fault from an invoke.
> The short answer is that there is nothing in the spec about SOAP and there
> are no built in functions to access the faultCode, faultActor, or
> faultString.
>
> The typical use case here is to define a catch for each fault that is
> defined on the operation you're invoking. Make sure the name and the fault
> message/element matches what's defined in the WSDL for the operation. Each
> catch defined in this way serves as a declaration of a variable of that
> message/element that is scoped to that catch. When the catch executes, you
> can access the contents of the fault message/element just like any other
> variable. Keep in mind, the contents of this variable will be limited to
> what's defined in the WSDL. If you're familiar with SOAP, then it's
> probably the first child element of the fault detail element.
>

--
View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24751923.html
Sent from the Apache Ode User mailing list archive at Nabble.com.





--
Mark Ford
MIT Lincoln Laboratory
244 Wood Street
Lexington MA 02420
(781) 981-1843

Re: How to use the element in BPEL?

Posted by kodeninja <ko...@gmail.com>.
Hi Mark,

Yes, this is exactly what I'm looking for. Just for clarity, if I invoke an
operation that has both input and output variables, and if it throws an
exception, then the output variable would be null, right? And if I'll be
able to access the exception/fault variable only in the specific catch
block, would I be able to get the actual fault string there?

-Kodeninja


mark.ford wrote:
> 
> It sounds like you're asking how to access the SOAP fault from an invoke.
> The short answer is that there is nothing in the spec about SOAP and there
> are no built in functions to access the faultCode, faultActor, or
> faultString.
> 
> The typical use case here is to define a catch for each fault that is
> defined on the operation you're invoking. Make sure the name and the fault
> message/element matches what's defined in the WSDL for the operation. Each
> catch defined in this way serves as a declaration of a variable of that
> message/element that is scoped to that catch. When the catch executes, you
> can access the contents of the fault message/element just like any other
> variable. Keep in mind, the contents of this variable will be limited to
> what's defined in the WSDL. If you're familiar with SOAP, then it's
> probably the first child element of the fault detail element.
> 

-- 
View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24751923.html
Sent from the Apache Ode User mailing list archive at Nabble.com.


Re: How to use the element in BPEL?

Posted by "Ford, Mark" <ma...@ll.mit.edu>.
There are three types of faults:

 *   standard BPEL faults like bpel:selectionFailure. These typically indicate a problem in your process where you've not implemented something correctly
 *   custom faults that you throw internally with the bpel:throw activity. This can be any type of xml data you want.
 *   faults resulting from web service invokes. The fault will be defined on the operation that you're invoking. An operation may define multiple faults.

It sounds like you're asking how to access the SOAP fault from an invoke. The short answer is that there is nothing in the spec about SOAP and there are no built in functions to access the faultCode, faultActor, or faultString.

The typical use case here is to define a catch for each fault that is defined on the operation you're invoking. Make sure the name and the fault message/element matches what's defined in the WSDL for the operation. Each catch defined in this way serves as a declaration of a variable of that message/element that is scoped to that catch. When the catch executes, you can access the contents of the fault message/element just like any other variable. Keep in mind, the contents of this variable will be limited to what's defined in the WSDL. If you're familiar with SOAP, then it's probably the first child element of the fault detail element.

On 7/30/09 3:11 AM, "kodeninja" <ko...@gmail.com> wrote:



Thanks for the pointer, Nelson. However, I'm still not clear on how to catch
hold of the actual exception trace/error code etc from the fault variable.
How to access that?

-Kodeninja
--
View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24733273.html
Sent from the Apache Ode User mailing list archive at Nabble.com.





--
Mark Ford
MIT Lincoln Laboratory
244 Wood Street
Lexington MA 02420
(781) 981-1843

Re: How to use the element in BPEL?

Posted by kodeninja <ko...@gmail.com>.
Thanks for the pointer, Nelson. However, I'm still not clear on how to catch
hold of the actual exception trace/error code etc from the fault variable.
How to access that?

-Kodeninja
-- 
View this message in context: http://www.nabble.com/How-to-use-the-%3Ccatch%3E-element-in-BPEL--tp24719833p24733273.html
Sent from the Apache Ode User mailing list archive at Nabble.com.


Re: How to use the element in BPEL?

Posted by Nelson Andrés Alvarez Salcedo <na...@itosmosys.com>.
El 29/07/2009 9:11, kodeninja escribió:
> Howdy,
>
> I want to understand the usage of the "catch" construct in BPEL 2.0. Are
> there any good tutorials that explain its typical usage?
>
> Consider the catch block below:
>
> <catch faultName="HorribleFault" faultType="ns1:HorribleFault"
> faultVariable="HorribleFaultVar">
> </catch>
>
> Here, does HorribleFaultVar need to be of type ns1:HorribleFault? Also, what
> are the generic properties of HorribleFaultVar that will be available? Like,
> how do I access the actual error message, error code if any, from this
> variable?
>
> Thanks,
> -Kodeninja
>
>    
Check this out: http://docs.oasis-open.org/wsbpel/2.0/wsbpel-v2.0.html, 
and look out for the Initial Example (5.1). OASIS in WS stuff is "your 
W3C". And luckily, ODE actually follows these standards pretty well.
-- 
Nelson Álvarez Salcedo
/"Verba volant, scripta manent"/