Call flow service with DT as input, using java

Now I have called flow service from java service like this:


IData inputKey = IDataFactory.create();
IDataCursor newPipeline = inputKey.getCursor();	
IDataUtil.put( newPipeline, "Doc/in", "This is the input value");
IDataCursor resultPipeline = Service.doInvoke("Sandbox.peturj.CallFlowFromJavaservice", "SingleInput", inputKey);
newPipeline.destroy();

This doesn’t work. Because the flow input is a variable called “in” inside a Document (called doc). Like this: https://dl.dropboxusercontent.com/u/11393522/input.PNG

Have anyone any idea how this can be done when the input variable is inside a document?

Thank you :slight_smile:

try this:
IData Doc1_1 = IDataFactory.create();
IDataCursor Doc1_1Cursor = Doc1_1.getCursor();
IDataUtil.put( Doc1_1Cursor, “in”, “Str1” );
Doc1_1Cursor.destroy();
IDataUtil.put( pipelineCursor_1, “Doc”, Doc1_1 );
pipelineCursor_1.destroy();

It works.

This is how it looks if anyone else is having the same problem:


		IData	Doc1_1 = IDataFactory.create(); 		
		IDataCursor Doc1_1Cursor = Doc1_1.getCursor(); 		
		IDataUtil.put( Doc1_1Cursor, "in", "This is the input string" );
		Doc1_1Cursor.destroy();
		
		IData 	Doc1_0 = IDataFactory.create();
		IDataCursor pipelineCursor_1 = Doc1_0.getCursor();
		IDataUtil.put( pipelineCursor_1, "Doc", Doc1_1 );
		pipelineCursor_1.destroy();
		
		IDataCursor resultPipeline = accessFlowService(Doc1_0).getCursor();
		String output = IDataUtil.getString(resultPipeline, "out");

The name of the output variable in the flow service is “out”.
And this is accessFlowService function that is being called.


	static IData accessFlowService(IData input) {		
		IData result = null;	
		try {	
			result = Service.doInvoke("Sandbox.peturj.CallFlowFromJavaservice", "SingleInput", input);
		} catch (Exception e) {	
			e.printStackTrace();
		}	
		return result;	
	}

Thanks for the answer :slight_smile: