You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Diptendu Dutta <du...@gmail.com> on 2019/03/11 06:06:15 UTC
[SCXML] Using to call a REST API
Is it possible to use the <send> tag to call a REST API?
How would one specify the various attributes such as method (GET/POST),
headers, body, etc.?
Is there any example code that I can consult?
Regards,
Diptendu Dutta
Re: [SCXML] Using to call a REST API
Posted by Woonsan Ko <wo...@apache.org>.
Hi Diptendu,
On Mon, Mar 11, 2019 at 2:06 AM Diptendu Dutta <du...@gmail.com> wrote:
>
> Is it possible to use the <send> tag to call a REST API?
Possible.
>
> How would one specify the various attributes such as method (GET/POST),
> headers, body, etc.?
You can pass any data in <send> to the target, and your
EventDispatcher may interpret the data to invoke an external service.
>
> Is there any example code that I can consult?
WizardsTest.java [1], to handle a custom type of send event used in
wizard-02.xml [2], registers a custom EventDispatcher which can read
type, target and data, and possibly invoke an external service.
FWIW, this is beyond the question, but it might be interesting to
implement a generic EventDispatcher to integrate with Apache Camel,
simply dispatching to a specific route based on <send> attributes.
e.g, type="camel" data="...", where data is passed to a Camel route as
message body.
Regards,
Woonsan
[1] https://github.com/apache/commons-scxml/blob/master/src/test/java/org/apache/commons/scxml2/WizardsTest.java#L62
[2] https://github.com/apache/commons-scxml/blob/master/src/test/java/org/apache/commons/scxml2/env/jexl/wizard-02.xml#L43
>
> Regards,
>
> Diptendu Dutta
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org