Java Client to start RBPM workflow using SOAP



By: kchendil

April 28, 2011 1:48 pm

Reads: 355

Comments:0

Rating:0

The Identity Manager User Application includes a workflow system that executes approval flows. A workflow process is based on a provisioning request definition, which is an XML document stored in the Identity Vault. The provisioning request definition describes an arbitrary topology using activities and links. For example, a provisioning request to grant an entitlement might have a workflow that collects approvals from relevant users and writes the entitlement to the directory.

To support access by third-party software applications, the provisioning workflow system includes a Web service endpoint. The endpoint offers all provisioning functionality (for example, allowing SOAP clients to start a new approval flow, or list currently executing flows). The Web service is built using the Novell Web Service SDK (WSSDK), which supports the WS-I Basic Profile, thus guaranteeing interoperability with other standards based SOAP implementations.

This article provides sample java code to start a workflow using SOAP Web service.

Prerequisites

To develop a Java client you must install a supported Java Developer’s Kit. Also, a client program needs the following JAR files:

* activation.jar
* commons-httpclient.jar
* IDMfw.jar
* log4j.jar
* saaj-api.jar
* wssdk.jar
* commons-codec-1.3.jar
* commons-logging.jar
* jaxrpc-api.jar
* mail.jar
* workflow.jar
* xpp3.jar

import javax.naming.InitialContext;
import com.novell.soa.af.impl.soap.AdminException;
import com.novell.soa.af.impl.soap.DataItemArray;
import com.novell.soa.af.impl.soap.Provisioning;
import com.novell.soa.af.impl.soap.ProvisioningRequest;
import com.novell.soa.af.impl.soap.ProvisioningRequestArray;
import com.novell.soa.af.impl.soap.ProvisioningService;
import com.novell.soa.af.impl.soap.StringArray;
import com.novell.soa.ws.portable.Stub;

public class Client2 {

	private static final String USERNAME = "uaadmin";
	private static final String PASSWORD = "novell";
	public static void main(String[] args) throws AdminException
	{
	try {
	String url = args.length > 0 ? args[0] :
	"http://localhost:8180/IDMProv/provisioning/service";
	startworkflow(url);
	} catch (Exception ex) {
	ex.printStackTrace();
	}
	}
	private static void startworkflow(String url) throws Exception {
		
		InitialContext ctx = new InitialContext();
		ProvisioningService service = (ProvisioningService) ctx.lookup("xmlrpc:soap:com.novell.soa.af.impl.soap.ProvisioningService");
		Provisioning prov = service.getProvisioningPort();	
		
		//Set up the stup(credentials,etc)
		Stub stub = (Stub) prov;
		// set username and password
		stub._setProperty(Stub.USERNAME_PROPERTY, USERNAME);
		stub._setProperty(Stub.PASSWORD_PROPERTY, PASSWORD);
		// set the endpoint URL
		stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);
					
		  ProvisioningRequestArray provReqArray = prov.getAllProvisioningRequests("cn=uaadmin,ou=sa,o=data");
		    ProvisioningRequest [] provRequest = provReqArray.getProvisioningrequest();
		    if(provRequest != null)
		    {		    	
		    	for (ProvisioningRequest provisioningRequest : provRequest) {
					
		    		if(provisioningRequest.getName().contains("myrole"))
		    		{
		    			DataItemArray itemArray = provisioningRequest.getItems();
		  		        StringArray ValueVal = new StringArray();
		  		        String[] StringVal ={"Provide me the resource2"};
		  				ValueVal.setString(StringVal);
		  		        itemArray.getDataitem()[0].setValue(ValueVal);
		  		        prov.start("cn=myrole,cn=RequestDefs,cn=AppConfig,cn=User Application Driver,cn=driverset1,o=system", "cn=uaadmin,ou=s,o=data", itemArray);
		    		}
				}		       
		    }
	}
}

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Categories: Uncategorized

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

Comment