How to call a java service from another java service

I have a setup of

JavaFolder
java_service1
java_service2
java_service3

In the code of java_service3 I want to call java_service2. I have existing code that calls this like the following but it lists it as an undefined function (red underline). When I debug this code it highlights the call in green and then errors out on the next step. I am not sure why this is not working but this service when run does run…

Should this be a valid way to call a java service from a java service?

if (expire == 0) {
java_service2(pipeline);
}

You can try using Service.doInvoke() to invoke a java service from another java service. For more information, please check the webMethods java API.

Cheers,
Sasanka

In generate code option …select the type2 as select this service for calling from other service and then paste that generated code in the actual or destination service. And pass the arguments as you want.