IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Call flow service with DT as input, using java

    Posted Tue April 29, 2014 06:52 PM

    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:


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-General


  • 2.  RE: Call flow service with DT as input, using java

    Posted Tue April 29, 2014 07:09 PM

    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();


    #webMethods-General
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Call flow service with DT as input, using java

    Posted Wed April 30, 2014 07:49 AM

    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:


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-General