Using soapUI and Lombardi WebAPIService to complete task

With yesterday’s findings, which I described in Using soapUI to access Lombardi WebAPIService, I thought about sending a SOAP message to complete a task in a process. What bothered me was how to pass data to a process instance so it’d become output variable(s) for an activity.

Let’s give the following business process definition a go.

The first activity of the BPD – Get Input Data – has privateData of type String as the single output variable.

Run the process so a token reaches the activity.

In Using soapUI to access Lombardi WebAPIService I described how to get at the activity with soapUI and Lombardi’s WebAPIService – a SOAP Web Service interface for Lombardi managed resources.

The WebAPIService provides the CompleteTask operation and its documentation (in WSDL) says:

“Complete a task for an activity in a process instance. This requires that the task is not closed and is assigned to the current user or to a role to which the current user belongs. The activity implementation for this task must be an External Activity or a Service. For InfoPath activity implementations, use one of the SubmitInfoPathForm(s) operations instead.”

With all this I was ready to fire up soapUI.

It worked fine, but it took me a while before I figured out what the correct SOAP message should’ve been sent.

<soapenv:Envelope
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:web="http://webapi.lombardisoftware.com">
   <soapenv:Header>
      <web:ClientInfo>
         <web:TimeZone>?</web:TimeZone>
         <web:Locale>?</web:Locale>
         <web:AcceptsTimeZone>?</web:AcceptsTimeZone>
      </web:ClientInfo>
   </soapenv:Header>
   <soapenv:Body>
      <web:CompleteTask>
         <web:taskId>55</web:taskId>
         <web:outputs>
            <!--Zero or more repetitions:-->
            <web:Variable>
               <web:Name>privateData</web:Name>
               <web:Value xsi:type="xsd:string">soapUI</web:Value>
            </web:Variable>
         </web:outputs>
      </web:CompleteTask>
   </soapenv:Body>
</soapenv:Envelope>

There are a couple of things to keep in mind before trying it out yourself.

First and foremost, web:ClientInfo is a mandatory element. Even though the values are meaningless, they have to be there.

Define the output variables of your activity with web:Value and have their type specified with xsi:type (plus the namespace declarations so the file is valid).

If you forget them weird things will certainly happen. I was faced with org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType and java.rmi.RemoteException: completeTask; nested exception is: java.lang.NullPointerException faultstrings with soapenv:Server.userException as faultcode.

With the message sent, go back to the Inspector and refresh the instances.

What’s worth to point out is that the output variable is really assigned the value having been sent.

I think I’m ready for a bit of REST.

Be Sociable, Share!
This entry was posted in WebSphere.

Leave a Reply

%d bloggers like this: