“The ‘com.wm.app.b2b.server.Service’
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” );
inputCursor.destroy();
//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
try{
output = Service.doInvoke( “allFolders.myFloder”, “foo”, input );
}catch( Exception e){}
IDataCursor outputCursor = output.getCursor();
// process output here
//destroy output cursor
outputCursor.destroy();
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
//factor-2
//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.
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services