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.  How to call wM flow service from a java service

    Posted Tue March 21, 2006 06:13 AM

    Hi,

    Could anybody pls let me know how to call a flow service (built in/custom developed) from a java service in wM Developer? Also if you can mention any wM documentation that would also help.

    Thanks for your help!
    Joy


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


  • 2.  RE: How to call wM flow service from a java service

    Posted Tue March 21, 2006 09:39 AM

    See Developers Guide (Chapt 14. Developing Client Code).

    Developer will automatically generate the following code
    (Tools–>GenerateCode…)

    ===========java service that calls a flow service (generated by Developer)
    // input
    IData input = IDataFactory.create();
    IDataCursor inputCursor = input.getCursor();
    IDataUtil.put( inputCursor, “flowInString”, “flowInString” );
    inputCursor.destroy();

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

    ===============hand coded java service that calls a flow service
    String javaInString;
    String javaOutString;

    String folder = “ladson_java2flow”;
    String service = “flowCallee”;

    //get java input
    IDataCursor idcPipeline = pipeline.getCursor();
    if(idcPipeline.first(“javaInString”))
    {
    javaInString = (String)idcPipeline.getValue();
    }
    else
    {
    System.out.println(“genCSVFileLoop: javaInString is not in pipeline!”);
    throw new ServiceException(“javaInString is not in pipeline!”);
    }

    //setup input for flow service
    String flowInString = javaInString;
    IDataCursor idcPipe = serviceIn.getCursor();
    idcPipe.first(“flowInString”);
    idcPipe.delete();
    idcPipe.insertBefore(“flowInString”, flowInString);
    idcPipe.destroy();

    //call flow service
    try
    {
    serviceOut = invokeISService(folder, service, serviceIn);
    }
    catch (Exception e)
    {
    throw new ServiceException(e);
    }

    //return output value
    String flowOutString;
    IDataCursor idcOutput = serviceOut.getCursor();
    if(idcOutput.first(“flowOutString”))
    {
    flowOutString = (String)idcOutput.getValue();
    }
    else
    {
    System.out.println(“java2flow: flowOutString is not in pipeline!”);
    throw new ServiceException(“flowOutString is not in returned pipeline!”);
    }
    System.out.println(“flowOutString=”+flowOutString);


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


  • 3.  RE: How to call wM flow service from a java service

    Posted Wed March 22, 2006 06:56 AM

    Create a subclass of Service class and use the doinvoke() methods to invoke any flow service from the java code. Refer to JAVA API for more details…can find it in the following path \webMethods6\Developer\doc\API\Java\


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


  • 4.  RE: How to call wM flow service from a java service

    Posted Thu August 17, 2006 08:17 AM

    Is there a way to do exactly this from standalone Java programe i.e. you a standard piece of java code that you write and wants have it executed which then invokes service in WM IS with inputs provided from the service? Basically to invoke IS service from outside the WM IS.

    Thanks,

    Ashish


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


  • 5.  RE: How to call wM flow service from a java service

    Posted Thu August 17, 2006 12:17 PM

    See Developers Guide (Chapt 14. Developing Client Code).

    (Tools–>GenerateCode–>For calling this service from a client–>java language

    Developer will automatically generate the following code

    /*

    • This class has been automatically generated by the webMethods Developer™.

    */

    import java.io.;
    import java.util.Vector;
    import com.wm.util.Table;
    import com.wm.data.
    ;
    import com.wm.util.coder.IDataCodable;
    import com.wm.app.b2b.util.GenUtil;
    import com.wm.app.b2b.client.Context;
    import com.wm.app.b2b.client.ServiceException;

    public class sayHelloFromFlow{

    <????????150 lines deleted for brevity ????????????????????>
    public static IData invoke(
    Context context, IData inputDocument)
    throws IOException, ServiceException
    {
    IData out = context.invoke("ladson_junk", "sayHelloFromFlow", inputDocument);
    IData outputDocument = out;
    return outputDocument;
    }
    

    }


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


  • 6.  RE: How to call wM flow service from a java service

    Posted Fri August 18, 2006 04:58 AM

    Thats great. Thanks it’s working now.


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


  • 7.  RE: How to call wM flow service from a java service

    Posted Mon April 27, 2009 04:09 AM

    This is really great.

    I was facing some issues with the java service.
    This snippet of the forum has really helped me to sort the problem.


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


  • 8.  RE: How to call wM flow service from a java service

    Posted Wed February 20, 2013 06:07 AM