webMethods

webMethods

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.  Calling flow service using java service

    Posted Mon February 03, 2014 03:16 PM

    How can I call a flow service using java service?


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


  • 2.  RE: Calling flow service using java service

    Posted Mon February 03, 2014 06:30 PM

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


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


  • 3.  RE: Calling flow service using java service

    Posted Tue February 04, 2014 06:16 AM


  • 4.  RE: Calling flow service using java service

    Posted Tue February 04, 2014 04:45 PM

    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!!


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


  • 5.  RE: Calling flow service using java service

    Posted Wed February 05, 2014 01:25 AM

    @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


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


  • 6.  RE: Calling flow service using java service

    Posted Wed February 05, 2014 08:29 AM

    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”.


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


  • 7.  RE: Calling flow service using java service

    Posted Wed February 05, 2014 09:10 AM


  • 8.  RE: Calling flow service using java service

    Posted Wed February 05, 2014 09:44 AM

    Looking for your code I found one error on mine!

    Thank you!! :smiley:


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