Calling flow service using java service

How can I call a flow service using java service?

check out the java doc for:
com.wm.app.b2b.server.Service
for details

IData outputValues = Service.doInvoke(“folderName”, “serviceName”, pipeline);

	//get a cursor for the output object

IDataCursor outputCursor = outputValues.getCursor();

@Luis:

http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_ga/Designer/8-2-SP1_Service_Development_Help.pdf

Page 245. [Generating Java Code from Service Input and Output Parameters]

HTH.

Thanks,
Rankesh

Tha’s not working… :frowning:

I call a service with the same inputs and outputs but the return is null!

Can someone see waht’s wrong?

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

	// input
	IData input = IDataFactory.create();
	IDataCursor inputCursor = input.getCursor();
	IDataUtil.put( inputCursor, "valorA", "valorA" );
	IDataUtil.put( inputCursor, "valorB", "valorB" );
			
	// output
	IData 	output = IDataFactory.create();
	try{
		output = Service.doInvoke( "folderName", "serviceName", input );
	}catch( Exception e){}
	
	IDataCursor outputCursor = output.getCursor();
	String	resultado = IDataUtil.getString( outputCursor, "resultado" );
	IDataUtil.put(outputCursor,"resultado", resultado);
	
	inputCursor.destroy();
	outputCursor.destroy();
		
}

Thanks!!

@Luis:

I assume you missed to replace the folder and service name. Sample code to call pub.string:concat from a java service:

Select the service that needs to be called in java service, right click -> select “Generate Code” -> select “For calling this service from other service” -> select “specification & fields” -> paste the clipboard data in java service.

// input
IData input = IDataFactory.create();
IDataCursor inputCursor = input.getCursor();
IDataUtil.put( inputCursor, “inString1”, “inString1” );
IDataUtil.put( inputCursor, “inString2”, “inString2” );
inputCursor.destroy();

// output
IData output = IDataFactory.create();
try{
output = Service.doInvoke( “pub.string”, “concat”, input );
}catch( Exception e){}
IDataCursor outputCursor = output.getCursor();
String value = IDataUtil.getString( outputCursor, “value” );
outputCursor.destroy();

HTH.

Thanks,
Rankesh

1 Like

I already have replaced the folder name and service name. I just use “folderName” to be easier to understand.

I tried your example and still not working; nothing is returning on “value”.

@Luis,

Please find the code as attachment.

Please feel free, in case you need more clarification.

Thanks,
Rankesh

1 Like

Looking for your code I found one error on mine!

Thank you!! :smiley: