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.  Java: abstract RPC client

    Posted Thu March 03, 2005 10:51 PM

    For interest sake only:

    I wrote a small base client class to instantiate the RPC Server stub. The name of the required stub is passed as a parameter to the constructor. There is an accessor which returns the stub instance (as an RPCService).

    In the client code, the call is done as follows:

    public void callNatural() throws Exception {
    // Call Natural subprogram TEST010N
    try {
    ((StubName)this.getRpcServer()).test010n(_sin);
    } catch (Exception e) {
    _log.error(e.getMessage()); // log RPC errors
    throw e; // pass exceptions on
    }
    // Check for application errors
    _serr = ((StubName)this.getRpcServer()).getTest010nStd_error();
    if (_serr.return_code != 0) {
    throw new ExAppException(_serr.return_msg);
    }
    // Get the ouput fields
    _sout = ((StubName)this.getRpcServer()).getTest010nServer_out();
    }

    Note how the RPCService is cast back to the Stub, to enable it’s methods.

    We have a standard parameter naming convention (01 level fields in Natural; inner classes in Java)): Server_in for fields passed to the server; Server_out for fields returned by the server and Std_error which contains a return-code and message. Positive codes mean transport or environment problems, negative codes mean application errors.

    If anyone is interested, I can post the actual code, and/or discuss further.

    Nothing is foolproof to a sufficiently talented fool…


    #webMethods
    #Mainframe-Integration
    #EntireX