# How to trigger Webservice through flowable modeler

**URL:** <https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992>\
**Category:** Flowable Designer\
**Created:** [December 5, 2018, 9:37am UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992 "2018-12-05T09:37:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://forum.flowable.org/u/Mohit)\
**Post date:** [December 5, 2018, 9:37am UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992/1 "2018-12-05T09:37:50Z")

</div>

Hi , can some body help me, how to create a process through modeler which triggers the webservice ?

---

<div class="post-metadata">

**Author:** ![yvo](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/yvo/32/2231_2.png) [@yvo](https://forum.flowable.org/u/yvo)\
**Post date:** [December 5, 2018, 12:01pm UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992/2 "2018-12-05T12:01:31Z")

</div>

Hi.

You can use a Http Task for executing a call to a REST service. It’s located in the Activities section on the palette.

Regards,

Yvo

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://forum.flowable.org/u/Mohit)\
**Post date:** [December 6, 2018, 5:20am UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992/3 "2018-12-06T05:20:48Z")

</div>

Any example through modeler is there ? Please share

---

<div class="post-metadata">

**Author:** ![Sebastiaan](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@Sebastiaan](https://forum.flowable.org/u/Sebastiaan)\
**Post date:** [December 11, 2018, 8:06am UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992/4 "2018-12-11T08:06:57Z")

</div>

A small xml that gets a JSON, parses it and creates an array so it can be used in a dropdownbox.  
If you create a process in modeler and export it to xml you should be able to insert this example into it.

```
<serviceTask id="GetProducts" name="GetProducts" flowable:type="http">
  <extensionElements>
    <flowable:field name="requestMethod">
      <flowable:string><![CDATA[GET]]></flowable:string>
    </flowable:field>
    <flowable:field name="requestUrl">
      <flowable:string><![CDATA[http://url/rmt-web/node/children/24321?token=cBaqMmeGjm]]></flowable:string>
    </flowable:field>
    <flowable:field name="saveRequestVariables">
      <flowable:string><![CDATA[true]]></flowable:string>
    </flowable:field>
    <flowable:field name="resultVariablePrefix">
      <flowable:string><![CDATA[products]]></flowable:string>
    </flowable:field>
    <flowable:executionListener event="end" class="org.flowable.engine.impl.bpmn.listener.ScriptExecutionListener">
      <flowable:field name="script">
        <flowable:string><![CDATA[//get response
                        print("");
                        print("start getProducts");
						responseBody = execution.getVariable("productsResponseBody");
						print("Products: " + responseBody);
						jsonObject = JSON.parse(responseBody);
 		  					    
 		  				//convert string into products array          				              				
          				var rmtNodes = new Array();			
						for (i = 0; i < jsonObject.length; i++) {
							rmtNodes[i]=new RmtNode(jsonObject[i].id,jsonObject[i].name);   
						}

						//prepare productsarray for dropdownbox 
						var jsonString = JSON.stringify(rmtNodes);
          				print("products dropdownbox: " + jsonString);
          				
          				//set variable for dropdownbox
          				print();
          				print();
          				execution.setVariable("cboProductValues",jsonString);
          				execution.setVariable("rmtUrl","24321");
          				
          				print(execution.getVariable("cboProductValues"));
          							
          				function RmtNode(id, name) {
          				    this.id = id;
           				    this.name = name;
          				}

          				print("getProducts done"); 
          				print("");]]></flowable:string>
      </flowable:field>
      <flowable:field name="language">
        <flowable:string><![CDATA[javascript]]></flowable:string>
      </flowable:field>
    </flowable:executionListener>
  </extensionElements>
</serviceTask>
```

---

<div class="post-metadata">

**Author:** ![martin.grofcik](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/martin.grofcik/32/71_2.png) [@martin.grofcik](https://forum.flowable.org/u/martin.grofcik)\
**Post date:** [December 11, 2018, 11:13am UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992/5 "2018-12-11T11:13:12Z")

</div>

Hi,  
jUnit tests in the flowable source

> <https://github.com/flowable/flowable-engine/blob/d05e91fee90098973a117a45c438c2ee60baaa9e/modules/flowable-http/src/test/java/org/flowable/http/bpmn/HttpServiceTaskTest.java#L44>

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![Mohit](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Mohit](https://forum.flowable.org/u/Mohit)\
**Post date:** [February 13, 2019, 6:36am UTC](https://forum.flowable.org/t/how-to-trigger-webservice-through-flowable-modeler/2992/6 "2019-02-13T06:36:06Z")

</div>

Hi can you please help me ?

After deploying flowable to cloudfoundry, modeler redirecting to login page always
