Contents |
iPlanet Process Manager, Version 6.5 Programmer's Guide |
This chapter describes how you can create client applications that use web services to communicate with iPlanet Process Manager applications. It provides an overview of the Simple Object Access Protocol (SOAP), describes the type of web services functionality provided by Process Manager, and shows how to create SOAP client applications.
Overview of SOAP and WSDL
iPlanet Process Manager provides web services using the Apache implementation of the Simple Object Access Protocol (SOAP) specification. SOAP is an XML-based protocol for the exchange of information in a decentralized, distributed environment. Refer to the iPlanet Process Manager Release Notes for the version of Apache SOAP that is supported for this release.
SOAP messages are XML documents that are typically exchanged over the HTTP transport. SOAP messages consist of a SOAP envelope (which defines the framework for the contents of a message), SOAP encoding rules (which define how instances of objects are serialized and marshalled between applications), and the SOAP RPC representation (which defines the conventions for remote procedure calls and responses). Process Manager handles the details of creating SOAP messages for you, including specifying the SOAP encoding rules and building the SOAP remote procedure calls and responses.
The Web Services Description Language (WSDL) is a specification that uses XML documents to describe web services. A WSDL file encodes network service information such as ports, messages, operations, and binding. You typically use a WSDL file as input to third-party utilities to generate stub code, which can then be used to create SOAP client applications.
For more information about the SOAP protocol, refer to http://www.w3.org/TR/SOAP. For information on the version of SOAP implemented by iPlanet Process Manager, refer to the iAS EPE Release Notes, available at http://docs.sun.com/prod/s1.ipaspro/. For more information on the WSDL specification, refer to http://www.w3.org/TR/wsdl.
Terminology
In SOAP encoding style, a compound type is a composite type, with each part being either a SOAP basic type or another compound type ultimately derived from SOAP basic types. SOAP uses compound data types to serialize objects passed in SOAP messages.
In SOAP encoding style, a simple type is scalar data type.
The Simple Object Access Protocol specifies a way to exchange information in a decentralized, distributed environment. SOAP encodes messages as XML documents containing three parts: an envelope providing information about the message and how to process it, a set of encoding rules that defines objects included in the message, and a convention for representing remote procedure calls and responses. SOAP messages are typically sent using the HTTP/HTTPS protocols. iPlanet Process Manager handles the creation, sending, and decoding of SOAP messages for iPM applications. For more information on SOAP, refer to http://www.w3.org/TR/SOAP.
Code generated when compiling a WSDL file. Skeleton code can be used to implement a server application that exports web services. WSDL compilers are available from various vendors and for various programming languages.
A SOAP Fault is an element of a SOAP message that contains error and/or status information. If present, the SOAP Fault appears within the body of a SOAP message.
Code generated from compiling a WSDL file. Stub code can be used to implement a client application that accesses web services made available from a server application. WSDL compilers are available from various vendors and for various programming languages.
The Web Services Description Language is a specification that uses XML documents to describe Web services. A WSDL file typically encodes network service information such as ports, messages, operations, and binding. iPlanet Process Manager provides a WSDL file that you can use as a starting point for creating your own SOAP clients to Process Manager. For more information on the WSDL specification, refer to http://www.w3.org/TR/wsdl.
iPM Web Services Architecture
Figure 7-1 illustrates how SOAP client applications access a Process Manager application.
Figure 7-1    iPM Web Services Architecture
Process Manager exposes web services that allows SOAP clients to perform operations on a process in an iPM cluster. SOAP clients call into the web services using Apache SOAP.
An Apache SOAP client is a Java application that uses Apache SOAP services to call into the Web Services API. A WSDL SOAP client is a client application created from stubs generated when compiling the iPM WSDL file provided with your Process Manager distribution. The following section, "Web Services Environment," describes the configuration files provided with your distribution to set up Process Manager for web services.
Web Services Environment
This section describes how to set up Process Manager to implement web services. It first discusses the configuration files provided with your distribution. It then describes how to configure your environment to use iPM Web Services.
Web Services Configuration Files
Table 7-1 lists configuration files that are provided with your Process Manager distribution. The following section, "Environment Setup," describes how these files are used when setting up your web services environment. In this table, <IPM_ROOT> indicates the root of your Process Manager installation.
Environment Setup
Configuring your environment to use Process Manager Web Services consists of the following steps:
- Setting up Process Manager to use web services
- Setting up the development environment for Apache SOAP client applications
- Setting up the runtime environment for Apache SOAP client applications
- Editing the provided WSDL file for WSDL client applications
Setting Up iPM to use Web Services
The following procedure describes how to set up Process Manager to use web services.
To Set Up Process Manager to Use Web Services:
- Create a default iPM cluster.
- Unjar ipmsoap-22.jar into the directory listed below:
<IAS_ROOT>/ias/APPS/modules/soap/WEB-INF/classes
IAS_ROOT is the root of your application server installation.
- Edit the deploy script in your Apache SOAP installation as follows:
On Windows platforms, edit the deploy.bat file. On Solaris, edit the deploy script. In each case, change IAS_HOME and CLASSPATH to point to the correct path in your environment.
- Deploy iPM Web Services by doing the following:
cd <IPM_ROOT>/bpm/soap/apache-2_2/
deploy DeploymentDescriptor.xml
IPM_ROOT is typically located at <IAS_ROOT>/iplanet/ipm65.
- Verify that iPM Web Services is installed by launching the Apache SOAP Administrator, available at the following URL:
http://<host>/NASApp/soap/admin/
The service iPM65WS should be listed in this screen.
Development Environment for Apache SOAP Clients
For developing (compiling) Apache SOAP clients, environment considerations include the following:
- Java Development Kit (JDK) version
- SOAP implementation version
- XML parser
- CLASSPATH properly configured to access SOAP and XML parser libraries
- ipmsoap-2_2.jar must appear before pm65soap.jar in your CLASSPATH
For information on specific versions supported, refer to the Process Manager Release Notes available at the following location:
Runtime Environment for Apache SOAP Clients
The runtime environment considerations for Apache SOAP clients include the following:
- Java Runtime Environment (JRE) version
- CLASSPATH properly configured to access pm65soap.jar
For information on specific versions supported, refer to the Process Manager Release Notes available at the following location:
Environment for WSDL Clients
You must modify the PMService-service.wsdl file provided with your distribution to specify the host and port for web services. In this file, edit the following line so host:port reflect the URL of the Apache SOAP service running on an iAS cluster.
<soap:address location="http:/host:port/NASApp/soap/rpcrouter"/>
Limitations Using SOAP with iPlanet Process Manager
When using SOAP services to access the process manager, keep in mind the following limitations:
- iPM expects SOAP messages in the SOAPRPC style, not the document style
- SOAP header and SOAP message chaining are not supported
- Functionality is limited to the web services exposed by Process Manager
- Data type conversion is limited to corresponding Process Manager data types
- Digital signature fields and file attachments for data elements are not supported
- Serialization and deserialization of iPM custom fields is not supported
This means custom fields cannot be used in a SOAP call involving saveActivity or completeActivity
- There is no authentication associated with calls to iPM Web Services
However, iPM Web Services does performs role resolution and allows (or disallows) certain tasks based on the AccessControl mechanism built into the Form ACL in the Process Builder. For example, a call to completeActivity succeeds only if the remoteUser passed in is actually an assignee or belongs to a Role that is an assignee to the Activity being completed.
- The completeActivity method can only be used with activities that have simple assignments (that is, a single user assigned to the activity)
WorkItems that have group assignments (use toGroup) or dynamic assignments that have resulted through the use of addAssignee calls cannot be handled by web services clients.
Creating Web Services Clients
You can create web services clients for iPlanet Process Manager either by creating an Apache SOAP client or by using code generated when compiling the iPM WSDL file provided with your Process Manager distribution. The following section, "Creating a Client Using the WSDL File", describes the procedure for creating a WSDL client. The section, "Creating an Apache SOAP Client" describes how to create an Apache SOAP client.
Typical Web Services Client Application
Typically, an iPM web services client creates a process instance for a specific entry point in a process. The client then performs an available activity for that process. The following steps list key iPM Web Services calls you make in the client to complete an activity for a process instance.
- Get the entry point into your Process Manager application.
Here are a series of method calls that are useful in finding an entry point into a Process Manager application, creating a process instance, and completing the activity.
getClusterNames
To get a list of the cluster names running in an iAS process instance.
getApplicationNames
From a specific cluster, get a list of the applications deployed on that cluster.
getEntryPointNames
From a specific application, get a list of the entry points into the application.
getEntryPointData
From a specific entry point, gets a list of the editable data elements.
- Create a process instance.
Using information from the previous step, call createProcessInstance to create a process instance.
- For the given process, complete an activity.
Here are a series of calls that are useful in finding and completing an activity for a process instance.
getActivityInfoList
Returns the worklist on a given cluster for a user. You can use this list to find specific activities.
getActivityData
Returns a list of data elements associated with an activity. You can use this list to perform work on the given activity.
completeActivity
Performs the specified action for a user activity.
Creating a Client Using the WSDL File
This section describes how to create a web services client using the following WSDL files provided with your distribution at iASROOT/soap/wsdl/.
- PMService.wsdl
Describes the web services methods available to access any iPM application.
- PMService.xsd
Describes the data types available to web services clients.
- PMService-service.wsdl
Used by third party applications to compile the WSDL files into stubs that can be used to create web services client applications. This file must be edited to reflect your iPM application's host name and port number, as described in "Environment for WSDL Clients".
To create a web services client, compile PMService-service.wsdl using a WSDL compiler compliant with the version of SOAP certified for this release. Using the stub files generated by the WSDL compiler, create your web services client application.
Creating an Apache SOAP Client
This section describes how to create an Apache SOAP client application. It lists the Java methods and classes available to clients from the iPM Web Services API. It also contains a running code example that shows how an Apache web services client can call into an iPM application. This example assumes you have set up your environment to use Apache SOAP, as described in "Development Environment for Apache SOAP Clients", and that you have deployed an iPM application to be invoked by a web services client. Finally, this section contains a description of the sample Apache SOAP client application provided with your Process Manager distribution.
iPM Web Services API for Apache SOAP Clients
This section lists the iPM Web Services methods available to Apache SOAP client applications. Table 7-2 lists the methods available to your client applications.
Table 7-2    iPM Web Services Methods available to Apache SOAP Clients
completeActivity
Completes the specified action associated with a user activity, saving the data associated with the activity. This action corresponds to a remote user completing and submitting a form, and then moving the process to the next stage.
Typically, you first call getActivityData to get a list of data elements for the activity, set the data for each element in the returned data list, and then call completeActivity.
void completeActivity(IWFActivityID activityID, String remoteUser,
IWFDataList datalist, String action)
activityID
ID of the activity.
remoteUser
Authorized user for the application.
datalist
List of IWFData elements associated with the activity. This list of data elements should be obtained by a prior call to getActivityData.
You should first call IWFData.setValue on each data element in the list before completing the activity. For more information on setValue, refer to "IWFData".
action
Name of the action being performed.
Exception
Generates a SOAP fault if the operation does not succeed.
createProcessInstance
Creates a process instance at a specific entry point in the process.
Typically, you first call getEntryPointData to get a list of data elements for the specified action in the process, set the data for each element in the returned data list, and then call createProcessInstance.
IWFProcessInfo createProcessInstance (String clusterName, String appName,
String entryNodeName, String remoteUser,
String actionName, IWFDataList datalist)
clusterName
Name of the cluster containing the deployed applications. Specify "PMCluster" if you are working with process applications deployed to a default cluster, otherwise specify the name of the named cluster.
appName
Name of the application deployed to the cluster.
entryNodeName
Entry point name of the application (previously returned by a call to getEntryPointNames).
remoteUser
Authorized user for the application.
actionName
Name of the action being performed at the entry point. This represents one possible transition emanating from the entry point node.
datalist
List of IWFData elements associated with the action. This list of data elements should be obtained by a prior call to getEntryPointData.
You should first call IWFData.setValue for each element in the list before creating the process instance. For more information on setValue, refer to "IWFData".
Exception
Generates a SOAP fault if the operation does not succeed.
getActivityData
Returns the list of editable data elements associated with a user activity. You can change the value of these data elements and then pass the list into a call to saveActivity or completeActivity. Before calling saveActivity or completeActivity, you should first call IWFData.setValue for each item in the returned list. For more information on setValue, refer to "IWFData".
getActivityInfo
Returns a user activity based on a primary key and a remote user (for role resolution). For more information on the IWFActivityInfo class, refer to "IWFActivityInfo"
getActivityInfoList
Returns the worklist for a remote user within the context of a given iPM cluster.
getApplicationNames
Returns the list of strings representing the names of deployed applications available on an iPM cluster.
getClusterInfo
Returns the properties of a given cluster. For more information on cluster properties, refer to "IPMClusterProperty". This method returns a limited list of cluster properties
For more information on the IWFClusterInfo class, refer to "IWFClusterInfo".
getClusterNames
Returns the names of iPM clusters available on an iAS cluster.
getEntryPointData
Returns a list of editable data elements associated with a specific entry point node of a process application. Role resolution is performed to check if the remote user has access at the entry point. From the returned IWFDataList, you should change only the value of elements in the IWFDataList.
You typically use the returned data list when creating a process instance (by calling createProcessInstance). Before creating the process instance, you should first call IWFData.setValue on each element of the returned list. For more information on setValue, refer to "IWFData".
getEntryPointNames
Returns the list of entry point names for the given application, which is deployed on the given cluster for the given user
getProcessInfo
Returns the information in a Process Instance, based on the Process Instance primary key. For more information on the IWFProcessInfo class, refer to "IWFProcessInfo".
saveActivity
Saves the data associated with a user activity. saveActivity does not complete the activity (move it to the next step).
Typically, you first call getActivityData to get a list of data elements for the activity, set the data for each element in the returned data list, and then call saveActivity.
void saveActivity(IWFActivityID activityID, IWFDataList datalist, String remoteUser)
activityID
ID of the activity.
data
List of data elements associated with the activity. This list of data elements should be obtained by a prior call to getActivityData.
You should first call IWFData.setValue on each data element in the list before saving the activity. For more information on setValue, refer to "IWFData".
remoteUser
Authorized user for the application.
Exception
Generates a SOAP fault if the operation does not succeed.
iPM Web Services Classes for Apache SOAP Clients
This section describes the classes used by Apache SOAP clients that access the iPM Web Services API. It provides a brief description of the class and lists the available accessor and mutator methods.
Table 7-3    iPM Web Services Classes for Apache SOAP Clients
IWFActivityID
Represents the unique identifier of a process activity in a running cluster.
IWFActivityInfo
Represents a process activity inside a cluster.
IWFActivityInfoList
List of IWFActivityInfo elements.
IWFAppNamesList
The list of application names on an iPM cluster. Typically, you do not make any modifications to this list.
IWFAssignee
An abstraction for a Process Manager role or user.
Methods
Description
String getType()
Returns the role or user.
String getValue()
Returns the name of the role or user.
IWFAssigneeList
List of IWFAssignee elements.
IWFClusterInfo
The properties of a cluster.
Methods
Description
String getProperty(String key)
Returns the value of a cluster property specified by the given key. Valid values for key are listed in Table 7-4.
Enumeration properties()
Returns an enumeration of the cluster properties.
Table 7-4    Key List of Cluster Properties
CLUSTER_DN
DATABASE_IDENTIFIER
CLUSTER_NAME
DATABASE_NAME
CONFIGURATION_DIRECTORY_SERVER
DATABASE_USER_NAME
CONFIGURATION_DIRECTORY_PORT
DATASOURCE_NAME
CONFIGURATION_DIRECTORY_BIND_DN
DESCRIPTION
CORPORATE_DIRECTORY_SERVER
PRETTY_NAME
CORPORATE_DIRECTORY_PORT
SMTP_SERVER
CORPORATE_DIRECTORY_BASE
SMTP_PORT
CORPORATE_DIRECTORY_BIND_DN
SMTP_REPLY_TO
DATABASE_TYPE
EVENT_USER
IWFClusterNamesList
A list of cluster names on an iPM installation. Typically, you do not make any modifications to this list.
IWFData
Represents a data dictionary element of the process application. The getActivityData and getEntryPointData methods of the iPM Web Service API returns a list containing these data elements (an IWFDataList). The IWFDataList represents fields in an HTML form or Process Manager activity.
Before using an IWFDataList in subsequent calls, you must set the data for each element in the list using IWFData.setValue.
Note When calling setValue, make sure the value passed in is a valid value for the data field. Process Manager throws an exception only if the value does not match the allowed type, as described in Table 7-5.
For example, if you specify text for the value of a CheckBox, an exception is thrown. However if you specify the value 2 for the value of a CheckBox, the error will not be caught or reported, and may cause the process to misbehave.
setValue must be called before you do the following:
- Create a process instance (using the iPM Web Services API createProcessInstance), to initialize the values of data fields for work items in the process
- Complete or save an activity (using the iPM Web Services APIs completeActivity or saveActivity), to first load the values of data fields for work items before completing or saving an activity.
For more information on the iPM Web Services API, refer to "iPM Web Services API for Apache SOAP Clients".
IWFDataList
Represents a list of IWFData elements. Refer to "IWFData" for more information on using an IWFDataList.
IWFEntryPointNamesList
List of entry point names on an iPM Application. Typically, you do not make any modifications to this list.
IWFProcessID
The unique identifier of a process instance in a running cluster.
IWFProcessInfo
Represents an instance of a process.
Creating an Apache SOAP Client Application
This section contains code examples that illustrate the basic steps in creating an Apache SOAP client.
Set Up the Web Services Class
The first step is to set up import statements and declare your class, as you would for any Java application. Code Example 7-1 shows one way to do this.
Create a Call Object
Next, create a Call object that you later use to invoke iPM Web Services API methods.
Map the Data Type for the Call
You must specify each iPM Web Services data type that you will be using in your call. For more information, refer to the section "IWFData".
Set the Method and Parameters to the Call
Code Example 7-4 sets the method name and builds the parameter list to the method. After building the parameter list, it sets the parameters for the call. In this example, the value for the dataList parameter for the method createProcessInstance should be obtained by a prior call to either getActivityData or getEntryPointData.
Refer to "iPM Web Services API for Apache SOAP Clients" for more information on web services methods exposed by Process Manager. Refer to "iPM Web Services Classes for Apache SOAP Clients" for more information on using iPM Web Services data types.
Invoke the Method and Capture the Return Value
Now invoke the method on the iPM, check for errors, and capture information returned by the method call.
Apache SOAP Client Sample
Your Process Manager distribution includes a sample Apache SOAP client application that instantiates the Credit History application, allowing the user to complete the Check Authorization activity. The sample can be found at the following location in your Process Manager installation:
<IPM_ROOT>/bpm/soap/sample/
This SOAP client provides the same functionality as Process Express for creating and completing the Credit History application. The initial data for process instantiation is pre-configured in a properties file. The sample application then uses the data generated by the Process Engine to complete the activity.
For more information on the Credit History application, refer to the Process Builder's Guide. For more information on calling iPM Web Services APIs in Apache SOAP clients, refer to "iPM Web Services API for Apache SOAP Clients".
Setting Up the Apache SOAP Client Sample
The Apache SOAP client sample assumes the Credit History process definition has been deployed successfully using the Process Builder. It also assumes that the SOAP service related parameters, such as SOAP service location URL and name are specified in the SOAPProperties.conf file. Also, the initial parameters for process instantiation are specified in the CALLParameters.conf file.
The CLASSPATH for the sample should contain pm65soap.jar, to specify SOAP data types and (de)serializers for these types. The CLASSPATH should also include xerces.jar and soap.jar.
iPM Web Services API
The Apache SOAP Client sample creates a process instance and completes the intermediate activities by calling the following iPM Web Services APIs (in the following order):
- getEntryPointData
Specifies the following parameters:
Returns IWFDataList containing the default entry point data, Person, and Title. To override the default entry point data, specify the desired Person name and Title in the CALLParameters.conf file.
- createProcessInstance
Creates a process instance specifying the following:
After creating the process instance, the Process Instance Id is displayed. The assignee of the activity can log in through Process Express and verify that a work item has been created corresponding to the user activity node "Check Authorization."
The sample then prompts whether you want to complete the Check Authorization activity (that is, take action on the work item generated). If you specify to not take action, the sample application exits. If you specify to take action, the following choices are displayed:
- Create Report (approval to check authorization)
- Cancel Report (deny authorization request)
When completing the activity, the sample calls the following iPM Web Services APIs (in the following order):
- getActivityData
Returns the activity data corresponding to the user activity "Check Authorization" for this process instance.
- completeActivity
Using the data returned by getActivityData and the actionName (create/cancel report), completes the user activity.
- getProcessInfo
Returns the final state of the process instance.
Contents