Hi,
I was able to implement the SOAP extension for C4 by extending the Axis2
Service Client.
I re-factored and enhanced the existing REST extension for C4 and
introduced the PUT and DELETE methods for the REST extension.
To use the REST task in a BPMN process, I implemented a REST extension as
an Activiti designer extension to the developer studio. After adding the
REST extension I implemented to the Activiti designer extensions, the REST
task will appear as a separate task in the tools palette. The REST task in
the palette will have all the properties/fields as mentioned below in the
main config tab, the user has to only give the required values to the
respective fields.
The following fields are required. Both fixed values i.e. strings and
expressions can be given :
*Field name*
*Definition*
serviceURL
Rest Endpoint URL
method
HTTP method (GET , POST, PUT or DELETE)
outputVariable
Name of the variable to save response
basicAuthUsername
Username if the endpoints are secured
basicAuthPassword
Password for the username provided
input
Request payload
headers
header values in the format "headerName1:headerValue1,headerName2:header
Value2"
*Eg: *
*Content-Type:application/json,Accept:application/json*
When the process is started and reaches the REST task, the task acts as
Service task and invokes *org.wso2.carbon.bpmn.extensions.rest.RESTTask* (
which is given as the runtime delegate class* @Runtime(javaDelegateClass =
org.wso2.carbon.bpmn.extensions.rest.RESTTask)*) which takes in the
parameters, invokes the rest service ,handles and returns the response
according to the parameters as given by the user.
Given below is an example on how the parameters are specified in the REST
task:
*<serviceTask id="servicetask1" name="REST Task"
activiti:class="org.wso2.carbon.bpmn.extensions.rest.RESTTask"
activiti:extensionId="org.wso2.developerstudio.bpmn.extensions.restTask.RESTTask">*
* <extensionElements>*
* <activiti:field name="serviceURL">*
* <activiti:expression>${serviceURL}</activiti:expression>*
* </activiti:field>*
* <activiti:field name="basicAuthUsername">*
* <activiti:string>admin</activiti:string>*
* </activiti:field>*
* <activiti:field name="basicAuthPassword">*
* <activiti:string>admin</activiti:string>*
* </activiti:field>*
* <activiti:field name="method">*
* <activiti:string>PUT</activiti:string>*
* </activiti:field>*
* <activiti:field name="input">*
* <activiti:string>{ "assignee": "Natasha", "description": "Changed from
PUT request"}</activiti:string>*
* </activiti:field>*
* <activiti:field name="outputVariable">*
* <activiti:string>output</activiti:string>*
* </activiti:field>*
* <activiti:field name="headers">*
*
<activiti:string>Content-Type:application/json,Accept:application/json</activiti:string>*
* </activiti:field>*
* </extensionElements>*
* </serviceTask>*
To add the new extension which contains the rest and soap task extensions
for the Activiti designer, build [1] or download the jar file attached in
[2].
To add the extension to Activiti Designer so the new customization i.e. the
rest task and soap task are applied, follow the instructions given below :
Go to Eclipse > select Window > Preferences .
In the preferences screen, type user as keyword. You should see an option
to access the User Libraries in Eclipse in the Java section.
Select the User Libraries item and a tree view shows up to the right where
you can add libraries. You should see the default group where you can add
extensions to Activiti Designer (depending on your Eclipse installation,
you might see several others as well).
Select the Activiti Designer Extensions group and add the extension jar as
an external jar to Activiti. After completing this, the preferences screen
will show the new extension as a part of the Activiti Designer Extensions
group. After adding the extension as above, the REST task and the SOAP task
will appear as separate tasks in the tool palette. These tasks can now be
used when designing bpmn processes.
[1]
https://github.com/NatashaWso2/devstudio-tooling-bps/tree/master/plugins/org.wso2.developerstudio.bpmn.extensions
[2] https://wso2.org/jira/browse/BPS-1054
Best Regards,
Natasha Wijesekare
On Tue, Jun 14, 2016 at 9:12 AM, Natasha Wijesekara <[email protected]>
wrote:
> Hi,
>
> Please find my comments inline
>
>> To use the SOAP task when designing BPMN processes, I implemented a SOAP
>>>> extension as an Activiti designer extension to the developer studio [1].
>>>> After adding the SOAP extension I implemented to the Activiti designer
>>>> extensions, the SOAP task will appear as a separate task in the tools
>>>> palette. The SOAP task in the palette will have all the properties/fields
>>>> as mentioned above in the main config tab, the user has to only give the
>>>> required values.
>>>>
>>> +1. This is great. Can we do same for Rest Task as well.
>>>
>>
>
>> +1 To use the REST task in a BPMN process I'll implement a REST
>> extension as an Activiti designer extension to the developer studio.
>>
>
>
>> *<activiti:field name="headers">*
>>>>
>>>> *<activiti:expression>${headers}</activiti:expression>*
>>>> **
>>>>
>>> In Header field, will it accept both expressions and fixed values ? if
>>> fixed values are supported can check feasibility implementing Activiti
>>> Designer's form support or
>>> PropertyType.DATA_GRID
>>> support for header fields. ?
>>>
>>
> This header property defines the Header block attached to the SOAP
> Header when creating the SOAP request. Yes, it can accept both expressions
> and fixed values. If its the HTTP transport headers you are
> referring to as given below , the HTTP transport headers are given as
> key,value pairs so it can accept both expressions and fixed
> values.
>
> *<activiti:field name="transportHeaders">*
>
> * <activiti:string>Cache-Control: no-cache, Pragma:
> no-cache</activiti:string>*
>
> * </activiti:field>*
>
> I have completed the implementation of the BPMN SOAP extension for
> C5 using Netty as the sender. Currently I'm working on the implementation
> of the SOAP extension for C4 using the Axis 2 service
> client.
>
>>
>>> +1. You will be able to implement
>>> this easily by extending Axis2 Service client.
>>>
>> +1 I will use the Axis2 Service client to implement the SOAP
> extension for C4.
>
>>
>>>
>>>
> Best Regards,
> *Natasha Wijesekare*
>
> *Software Engineering Intern, WSO2 Inc: http://wso2.com
> <http://wso2.com/>*
> *email : [email protected] <[email protected]>*
> *mobile: +94 771358651 <%2B94%20771358651>*
>
--
*Natasha Wijesekare*
*Software Engineering Intern, WSO2 Inc: http://wso2.com
<http://wso2.com/>*
*email : [email protected] <[email protected]>*
*mobile: +94 771358651*
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture