Calling flow service from a java serice

can anyone tell me the exact procedure to call an inbuilt flow service from a java serice (from the developer) in webMethods 6.0.1?


“The ‘’
class contains a collection of methods for gaining access to Objects commonly used by Server services. It may be desirable to subclass Service when creating server-side code…”

Use one of the overloaded versions of “doInvoke” (Note: some of these methods are deprecated.

// input
IData input = IDataFactory.create();
IDataCursor inputCursor = input.getCursor();
//put the input IData Objects in pipeline
IDataUtil.put( inputCursor, “input”, “Hello World” );
//create an output IData Object
// output
IData output = IDataFactory.create();

//specify the foldername where the inbuit flow service resides and name of the flow service
output = Service.doInvoke( “allFolders.myFloder”, “foo”, input );
}catch( Exception e){}
IDataCursor outputCursor = output.getCursor();
// process output here

//destroy output cursor

I generally avoid these calls as the same effect can be achieved using a flow service and refactoring of an existing java service. It may not be possible all the time, esp when youre maintaining an existing piece of code and the refactoring efforts are costly.

If youre doing construction, you can avoid java to flow service calls in the following manner.

public static final void maintenanceNigtmare(IData pipeline) throws ServiceException {

//factor -1
//java code

//I need to call an inbuit flow service here

//rest of my java code


You can factor your java service into two java services, javaService1 and javaService2 with code from factor-1 and factor-2. Create a flow service that drives the execution, calls the newly created javaService1 and then the inbuilt flow Service and finally newly created javaService2 using INVOKE steps. The code is a lot maintainable.

There is a webMethods-Java API option provided in the Developer tool under Help (tab) in which there is a link that takes you to browse the built-in java API Reference.

In that under (Service) Class there are number of methods available like doInvoke()… which is used to invoke a flow service dynamically.