Tuesday, July 28, 2015

#425 Process Cloud Service --> REST API -- Initiating a process

Firstly, a very big thanks you to my colleague Ralf M. for his input here.

Here is my process -

I pick up the wsdl from the management page in Composer -

I use this to create a new project in SOAP-UI.

Here is my request -

Here is the task in Workspace -

Now to the construction of the REST call -

I discussed in a previous post how one can use the REST api

to retrieve processDefId, serviceName and operation.

Now to the payload parameter -

I use the soap-ui request as the basis for the payload value.

Here it is again -

Here is my .json file -

You can download it here

I use ns1 and ns2 instead of nial and _qy

Regarding escape characters - I used this site to validate.

Here is the curl request -

curl -u phillip:welcome1 -H "Content-Type:application/json" -H "Accept:application/json" -X POST -d @NCCreateInstance.json http://YourCloudInstance/bpm/api/1.0/processes

I check in Workspace -

Simple stuff!

Monday, July 27, 2015

#424 Process Cloud Service - REST API - passing parameters Part I

In this post I look at a couple more of the PCS REST APIs -

I am using the following process for demo purposes -

What processes do I have?

This is just to recap -

try GET /process-definitions

curl -u phillip:welcome1 -H "Content-Type:application/json" -H "Accept:application/json" -X GET http://yourCloudInstance/bpm/api/1.0/process-definitions

Here is part of the response I get -


Here I see the processDefId is testing/SimpleOrderApp!1.0*soa_66f7e718-81cb-4a3e-

The serviceName is SimpleOrderProcess.service

The operation is start

Now, I have an instance of this process running -

I can get a user's tasks using the following API -

GET /tasks

curl -u phillip:welcome1 -H "Content-Type:application/json" -H "Accept:application/json" -X GET http://yourCloudInstance/bpm/api/1.0/tasks

Here I get the taskId, in this case, it is 200073.

Using the following REST API, I can add a comment to this task -

POST /tasks/taskId/comments

I try the following on Windows but get an Unexpected character error.
curl -u phillip:welcome1 -H "Content-Type:application/json" -H "Accept: application/json" -X POST -d '{"commentStr":"Good customer"}' http://yourCloudInstance/bpm/api/1.0/tasks/200073/comments

Note how I pass the parameters -
-d '{"commentStr":"Good customer"}'

The syntax is described in detail in the docs here

So how do I get over this error?
I simply do as described in the docs - I put the json snippet into a file.

I then revise the command as follows -

curl -u phillip:welcome1 -H "Content-Type:application/
json" -H "Accept:application/json" -X POST -d @NCaddComment.json http://yourCloudInstance/bpm/api/1.0/tasks/200073/comments

Let's look at the NCaddComment.json file -

I execute the command -

I check in Workspace -

And yes, I did execute the request twice.

Now I will reassign a task from phillip to renate.

Here are phillip's tasks -

Here is my reassign for the SimpleOrderApp (taskid 200079) -

curl -u phillip:welcome1 -H "Content-Type:application/json" -H "Accept:application/json" -X POST -d @NCreassignTask.json http://yourCloudInstance/bpm/api/1.0/tasks/200079/reassign

Here is the .json file -


Here is the execution -

I validate in Workspace - phillip now has only 1 task -

I login as renate -

I check the History -

Monday, July 20, 2015

#423 Process Cloud Service --> Exporting Audit data

I log in to Workspace as my admin user, phillip.

I click on Tracking, and check on completed instances.

 I will now export the completed instances of MyOrderProcess.

I select the application(s) I want to export, in this case, NCOrderApp.

I specify an email address and to delete after export.


Click on Completed link, once it appears -

Zip is downloaded -

#422 Process Cloud Service --> testing processes from SOAP-UI

Here is my sample process -

Interface (Start Activity) -

User niall is an Approver.

I deploy the app to the Test partition.

Back in Composer, I log in as my admin user, phillip.

I select my app, MyNewOrdersApp - and then click Actions.

Yes, I have deleted some of the details above.

Take the wsdl and leverage in SOAP-UI

Execute the Request in SOAP-UI.

Login to Workspace as user niall.

Click on Tasks.

#421 Process Cloud Service --> Resolving Recoverable Instances

Still using the ubiquitous order process...
I add a new Service Task to call a Security Check Service.

Here are some test results for the service, using SOAP-UI.

The business logic is very simple -

If restricted  and country = "Ireland" throw the SecurityException.

I zip up the web service WSDL and XSD and import into PCS.

I add to the process -

Test -

I log in as my admin user and click on Tracking -

I click on Change Variables and Recover.

I change Ireland to Eire and click OK.

We see the instance has progressed -