Starting a Business Service
An example is provided that shows how calls to the Work Manager Services API can be used to start and update a business service.
The following step-by-step descriptions correspond to the numbered steps in the illustration above. Note that the descriptions are from a web service operation point of view, and provide an example of performing the operations using the web service API (SOAP). (For an equivalent example using the Service Connector API (Java), see Starting a Business Service — Service Connector API Example (Java).)
Procedure
- When you login to a client, for example TIBCO Openspace, listCategories is called and all the available categories are listed in the Business Services tab.
-
When the user clicks on a category,
queryBusinessServices is called and all the business services under the selected category are displayed. The response contains the details of all the business services under the selected category.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://business.api.busserv.n2.tibco.com"> <soapenv:Header/> <soapenv:Body> <bus:queryBusinessServices> <category>PageflowSolution/ProcessPackage</category> </bus:queryBusinessServices> </soapenv:Body> </soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <queryBusinessServicesResponse xmlns="http://business.api.busserv.n2.tibco.com"> <businessServiceTemplate hasFormalParameters="false" moduleName="/PageflowSolution/Process Packages/ProcessPackage.xpdl" processName="RequestCall" version="1.0.0.201108111516" xmlns=""/> </queryBusinessServicesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
- Selecting a business service displays the details of that business service on the client, which are obtained from the response message of the queryBusinessServices call.
-
When the user clicks the button to start a new instance of business service, it calls the
startBusinessService and passes the parameters module name, process name, and version number. The values for these parameters can be obtained by calling
queryBusinessServices or
listBusinessServices.
The response returns the execution state, process ID, activity ID, and the payload.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://business.api.busserv.n2.tibco.com"> <soapenv:Header/> <Soapenv:Body> <bus:startBusinessService> <businessServiceDefinition moduleName="/PageflowSolution/Process Packages/ProcessPackage.xpdl" processName="RequestCall" version="1.0.0.201108111516"/> <responsePayloadMode>XML</responsePayloadMode> </bus:startBusinessService> </soapenv:Body> </soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <startBusinessServiceResponse xmlns="http://business.api.busserv.n2.tibco.com"> <pageResponse executionState="IN_PROGRESS" xmlns=""> <context> <pageFlowTemplate hasFormalParameters="false" moduleName="/PageflowSolution/Process Packages/ProcessPackage.xpdl" processName="RequestCall" version="1.0.0.201108111516"/> <processReference> <id>pvm:0a101v</id> <name>RequestCall</name> </processReference> </context> <pageData> <pageReference activityId="pvm:001g1v.3" activityModelId="_qTxqOlnREd-qRKl4nKSPqA" activityName="CollectData" moduleName="/PageflowSolution/Process Packages/ProcessPackage.xpdl" moduleVersion="1.0.0.201108111516" processName="RequestCall"/> <payload payloadMode="XML"> <XmlPayload> <inouts array="false" name="UserName" optional="true" type="String"> <simpleSpec/> </inouts> <inouts array="false" name="PhoneNumber" optional="true" type="String"> <simpleSpec/> </inouts> </XmlPayload> </payload> </pageData> </pageResponse> </startBusinessServiceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
- If the business service has a form associated with it, the operation getBusinessServiceDetailsByModule is called. The response contains the form details, which are then passed on to the Forms Adapter.
-
The Forms Adapter parses the data and displays an appropriate Form to the end user. Similarly, any input provided in the form is processed by the Form Adapter and handed back to the servlet.
For details about how the data is passed to and received from the Forms Adapter, see Working With Forms.
-
Once the user enters values in the Forms fields and clicks submit,
updateBusinessService is called with the payload containing the values entered by the and user. Repeat steps
5 and
6 until the business service completes or is cancelled.
The response returns the execution state, process ID, activity ID, and the payload. If the business service is complete, the execution state is COMPLETED.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://business.api.busserv.n2.tibco.com"> <soapenv:Header/> <soapenv:Body> <bus:updateBusinessService> <context> <processReference> <id>pvm:0a101v</id> </processReference> <activityReference activityId="pvm:001g1v.3"/> </context> <pageFields payloadMode="XML"> <XmlPayload> <inouts array="false" name="UserName" optional="true" type="String"> <simpleSpec> <value>TIB_USER1</value> </simpleSpec> </inouts> <inouts array="false" name="PhoneNumber" optional="true" type="String"> <simpleSpec> <value>987654321</value> </simpleSpec> </inouts> </XmlPayload> </pageFields> <responsePayloadMode>XML</responsePayloadMode> </bus:updateBusinessService> </soapenv:Body> </soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <updateBusinessServiceResponse xmlns="http://business.api.busserv.n2.tibco.com"> <pageResponse executionState="COMPLETED" xmlns=""> <context> <pageFlowTemplate hasFormalParameters="false" moduleName="/PageflowSolution/Process Packages/ProcessPackage.xpdl" processName="RequestCall" version="1.0.0.201108111516"/> <processReference> <id > pvm:0a101v</id <name>RequestCall</name> </processReference> </context> <pageData> <payload payloadMode="XML"> <XmlPayload xmlns:bus="http://business.api.busserv.n2.tibco.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <inouts array="false" name="UserName" optional="true" type="String"> <simpleSpec> <value>TIB_USER1</value> </simpleSpec> </inouts> <inouts array="false" name="PhoneNumber" optional="true" type="String"> <simpleSpec> <value>987654321</value> </simpleSpec> </inouts> </XmlPayload> </payload> </pageData> </pageResponse> </updateBusinessServiceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>