cancel
Showing results for 
Search instead for 
Did you mean: 

Start GP Process using web services

Former Member
0 Kudos

Hi,

I am trying to start a GP process from a Java EJB project using WSDL created by GP component for a particular template. I have created the deployable client proxy from the WSDL and added the reference in the EJB project.

Any idea how to use different proxy classes within the EJB project to start the process.

Thanks

Rajeev

Accepted Solutions (1)

Accepted Solutions (1)

former_member198228
Active Participant
0 Kudos

Hello Rajeev,

You can do this. All you have to do is the following steps

1. Create your template

2. Then use the GP wsil to get the wsdl.

3. Generate the proxy off of the wsdl and u are good to go.

Hope that helps

Abdul

Former Member
0 Kudos

Hi Abdul,

I was looking something after step 3 which you have mentioned. I have created the proxy and was wondering how to use that in my J2EE project. If you have any example code then please let me know.

thanks

Rajeev

former_member198228
Active Participant
0 Kudos

Hi Rajeev,

i haven't done one with EJB triggerred it from webdynpro. here is a snippet that kicks of the sample time off process using api from webdynpro

IUser user = null;

IGPStructure params = null;

// Get current user

try {

IWDClientUser wdUser = WDClientUser.getCurrentUser();

user = wdUser.getSAPUser();

// obtain the Process template

IGPProcess process =

GPProcessFactory.getDesigntimeManager().getActiveTemplate(

// by specifying its ID

processId,

// and the user accessing it

user);

// obtain the Run Time Manager

IGPRuntimeManager rtm = GPProcessFactory.getRuntimeManager();

// create a new, empty role assignment list

IGPProcessRoleInstanceList roles = rtm.createProcesRoleInstanceList();

// get the number of roles required

int rolenum = process.getRoleInfoCount();

// iterate over the required roles

for (int i = 0; i < rolenum; i++) {

// add a new role assignment to the list

roles.createProcessRoleInstance(

// by specifying the role's unique name

process.getRoleInfo(i).getRoleName()).addUser(

// add the current user to every process role

user);

}

// Here you see how to populate parameters with data.

// This example only works, if you initiate the "Time-Off process"

// that is delivered per default with the GP Framework.

// You find it in the gallery below "Examples".

// Otherwise no parameters are initialized.

params= GPStructureFactory.getStructure(process.getInputParameters());

if (process.getTitle().equals("Time-Off Process")){

IGPStructure struc = params.addStructure("Time_off_data.1");

struc.setAttributeValue("AbsenceTypeText", "Vacation");

struc.setAttributeValue("SimulationCode",0);

struc.setAttributeValue("CompletionCode",0);

struc.setAttributeValue("PaidFlag", true);

}

// initiate the process template by passing the Process template

rtm.startProcess(process,

// a name,

"API started Process",

// a description,

"This process has been started from a WebDynpro via public API",

// the initiating user

user,

// the role assignment,

roles,

// the initial parameters

params,

// and the user actually executing this action

user);

} catch (WDUMException ex) {

logger.traceThrowableT(Severity.ERROR,

"Current user could not be resolved: ", ex);

} catch (GPInvocationException ex) {

logger.traceThrowableT(Severity.ERROR,

"Exception raised when trying to start process: ", ex);

} catch (GPEngineException ex) {

logger.traceThrowableT(Severity.ERROR,

"Exception raised when trying to start process: ", ex);

}

Hope that helps

Abdul

Former Member
0 Kudos

Thanks Abdul for your response.

The code you have provided is through GP APIs whereas I wanted to start the through web services. I believe it has to be something like this.

RoleList rl = new RoleList();

Roles role = new Roles();

Input input = new Input();

InputTypeLabel inputTypeLable = new InputTypeLabel();

try {

port.startProcess("Test process", "Test Process", role, inputTypeLable, null);

} catch (RemoteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (ProcessRuntimeException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (NoSuchProcessException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (NoProcessExecutePermissions e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

but i am not sure how to fill the role and inputtypelable objects.

any idea, please let me know.

thanks

Rajeev

Former Member
0 Kudos

Hi Rajeev,

I had the same requirement as your. Can you tell me how you have implemented your requirement. If possible provide me with some links

Thanks in advance

Satya

Answers (0)