Re: [Dev] How to catch an error from the REST Task in the BPMN

2017-09-29 Thread Sudharma Subasinghe
Hi Thomas,

Can you try without setting *errorRef, *so as in [1] the boundary error
event will catch any error event.

[1] https://www.activiti.org/userguide/#bpmnBoundaryErrorEventXml

On Thu, Sep 28, 2017 at 12:38 PM, Thomas LEGRAND <
thomas.legr...@versusmind.eu> wrote:

> Hello,
>
> Thank you for your answers but what if my configured JSON path is not
> applicable for the returned body in case of an error triggered in the web
> service side? I mean, there is two cases :
> - I request something and this something is returned by the web service.
> The REST task uses the configured JSON path to set an attribute.
> - I request something but this something does not exist. So the web
> service sends me a 404 HTTP code with another body (like an empty one or
> even a JSON object modelizing an error with a business error code and a
> message). This body does not correspond at all to the configured JSON path.
> So, the exception is triggered:
>
> Unknown Exception occurred
>> com.jayway.jsonpath.PathNotFoundException: No results for path:
>> 
>
>
> The ErrorBoundaryEvent will not "catch" this error. Is there a way to
> configure the ErrorBoundaryEvent to catch whatever error is popping, or
> should I create a ErrorBoundaryEvent for each error? Meaning that I don't
> know what is the name of the error spawning where the JSON path is wrong.
>
> Regards,
>
> Thomas
>
> 2017-09-28 6:34 GMT+02:00 Sudharma Subasinghe :
>
>> Hi Thomas,
>>
>> You can add ErrorBoundaryEvent with error code as* "RestInvokeError"*.
>> Please refer [1] as an example.
>>
>> [1] http://wso2.com/library/articles/2016/04/article-how-to-
>> model-bpmn-business-processes-with-wso2-business-process-server/#error
>>
>> Thanks
>> Sudharma
>>
>> On Wed, Sep 27, 2017 at 8:04 PM, Thomas LEGRAND <
>> thomas.legr...@versusmind.eu> wrote:
>>
>>> Hello there,
>>>
>>> I would like to catch an error from the REST task in my process.
>>> Actually, my distant web service returns a 404 with an empty body if no
>>> result was found. If something was found, I map an element from the
>>> returned JSON into a variable and that works.
>>>
>>> In the case of my 404, I have a NPE and I would like to catch it to be
>>> able to continue the process but I don't know how to do because the
>>> ErrorBoundaryEvent I attached does not work at all.
>>>
>>> Can you help me, please?
>>>
>>> Regards,
>>>
>>> Thomas
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sudharma Subasinghe,
>> Software Engineer,
>> WSO2 Inc.
>> Email: sudhar...@wso2.com 
>> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>>
>
>


-- 
Sudharma Subasinghe,
Software Engineer,
WSO2 Inc.
Email: sudhar...@wso2.com 
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to catch an error from the REST Task in the BPMN

2017-09-28 Thread Thomas LEGRAND
Hello,

Thank you for your answers but what if my configured JSON path is not
applicable for the returned body in case of an error triggered in the web
service side? I mean, there is two cases :
- I request something and this something is returned by the web service.
The REST task uses the configured JSON path to set an attribute.
- I request something but this something does not exist. So the web service
sends me a 404 HTTP code with another body (like an empty one or even a
JSON object modelizing an error with a business error code and a message).
This body does not correspond at all to the configured JSON path. So, the
exception is triggered:

Unknown Exception occurred
> com.jayway.jsonpath.PathNotFoundException: No results for path: 


The ErrorBoundaryEvent will not "catch" this error. Is there a way to
configure the ErrorBoundaryEvent to catch whatever error is popping, or
should I create a ErrorBoundaryEvent for each error? Meaning that I don't
know what is the name of the error spawning where the JSON path is wrong.

Regards,

Thomas

2017-09-28 6:34 GMT+02:00 Sudharma Subasinghe :

> Hi Thomas,
>
> You can add ErrorBoundaryEvent with error code as* "RestInvokeError"*.
> Please refer [1] as an example.
>
> [1] http://wso2.com/library/articles/2016/04/article-how-
> to-model-bpmn-business-processes-with-wso2-business-process-server/#error
>
> Thanks
> Sudharma
>
> On Wed, Sep 27, 2017 at 8:04 PM, Thomas LEGRAND <
> thomas.legr...@versusmind.eu> wrote:
>
>> Hello there,
>>
>> I would like to catch an error from the REST task in my process.
>> Actually, my distant web service returns a 404 with an empty body if no
>> result was found. If something was found, I map an element from the
>> returned JSON into a variable and that works.
>>
>> In the case of my 404, I have a NPE and I would like to catch it to be
>> able to continue the process but I don't know how to do because the
>> ErrorBoundaryEvent I attached does not work at all.
>>
>> Can you help me, please?
>>
>> Regards,
>>
>> Thomas
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Sudharma Subasinghe,
> Software Engineer,
> WSO2 Inc.
> Email: sudhar...@wso2.com 
> Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to catch an error from the REST Task in the BPMN

2017-09-27 Thread Manorama Perera
Hi Thomas,

When a failure occurs in a REST task, a BPMN error with error code
"RestInvokeError" will be thrown.
This error can be caught using an Error Boundary Event associated with the
REST service task.

You can find an example of using this in the article[1].

[1] http://wso2.com/library/articles/2016/04/article-how-
to-model-bpmn-business-processes-with-wso2-business-process-server/

Thanks,
Manorama.

On Wed, Sep 27, 2017 at 8:04 PM, Thomas LEGRAND <
thomas.legr...@versusmind.eu> wrote:

> Hello there,
>
> I would like to catch an error from the REST task in my process. Actually,
> my distant web service returns a 404 with an empty body if no result was
> found. If something was found, I map an element from the returned JSON into
> a variable and that works.
>
> In the case of my 404, I have a NPE and I would like to catch it to be
> able to continue the process but I don't know how to do because the
> ErrorBoundaryEvent I attached does not work at all.
>
> Can you help me, please?
>
> Regards,
>
> Thomas
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Manorama Perera
Software Engineer
WSO2, Inc.;  http://wso2.com/
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] How to catch an error from the REST Task in the BPMN

2017-09-27 Thread Sudharma Subasinghe
Hi Thomas,

You can add ErrorBoundaryEvent with error code as* "RestInvokeError"*.
Please refer [1] as an example.

[1]
http://wso2.com/library/articles/2016/04/article-how-to-model-bpmn-business-processes-with-wso2-business-process-server/#error

Thanks
Sudharma

On Wed, Sep 27, 2017 at 8:04 PM, Thomas LEGRAND <
thomas.legr...@versusmind.eu> wrote:

> Hello there,
>
> I would like to catch an error from the REST task in my process. Actually,
> my distant web service returns a 404 with an empty body if no result was
> found. If something was found, I map an element from the returned JSON into
> a variable and that works.
>
> In the case of my 404, I have a NPE and I would like to catch it to be
> able to continue the process but I don't know how to do because the
> ErrorBoundaryEvent I attached does not work at all.
>
> Can you help me, please?
>
> Regards,
>
> Thomas
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sudharma Subasinghe,
Software Engineer,
WSO2 Inc.
Email: sudhar...@wso2.com 
Mobile : +94 710 565 157 <%2B94%20718%20210%20200>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev