Performing REST Call from IBM BPM server Script

IBM BPM provide a connector "read from http" in system toolkit to invoke the REST service call. This connector supports both get and post methods while invoking the REST Service. But the disadvantage with this is that it will support only when the input is in the form of either query parameters or form parameters, but not when the input has to be sent as Entity to the REST service.
In this Post, I would like to illustrate an example on how to perform a rest call which where the input has to be passed an entity  instead of name and value as illustrated in my other post.

Below is the xml input which has to be passed to the rest service. let us use a server scriptlet to bind this input xml to the variable tw.local.inputString.


<Reqest><control>420131</control><suffix>10</suffix> <account>1</account><planData><planNumber>21</planNumber><planEffectiveDate>2014-01-10</planEffectiveDate></planData></Request>

Below code can be to invoke the rest service by passing the necessary input to the service call. 

var client =new;

var input =new;
var post = new;
var response = client.execute(post);
//var entity = response.getEntity();
tw.local.output =,"");

Below shown is the xml output the above response, which is in String format.

<Response>   <getCount>    <planNumber>21</planNumber>
    <planEffectiveDate>2014-01-10</planEffectiveDate>     <subscribers>0</subscribers>     <members>0</members>  </getCount>   <getCount>    <planNumber>0</planNumber>    <planEffectiveDate />    <subscribers>0</subscribers>    <members>0</members>  </getCount>  </Response>

After getting the response as a string, you can convert that to XML as below:

tw.local.response =;

you can also refer the post on how to convert XML string to XML.

Hope this post is usefull !!!

Thanks for stopping by. If you like this post leave a comment, share it and do a g +1.

1 comment:

  1. Hi,
    I'm using Read from HTTP to call another Web App installed in the same WAS
    but getting error -- No target URL has been specified
    Can you please help