ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Best way to call a SRVPGM from Java?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best way to call a SRVPGM from Java?

    Hi,

    I have been tasked with coming up with some prototypes for a new Java UI to an old as400 legacy system. I have plenty of ideas for the Java side of things and the legacy system is pretty much as it is. I think the crux of the problem is the interface between the two.

    I would like to ask what experiences people have of this?

    The legacy system consists of a number of RPGLE service programs that need to be called with the correct library list. The exported procedures I would have to call might look something like this:
    PHP Code:
    InitialiseCustomerForAdd();
    SetName(name);
    SetAddress(address);
    SetDOB(dob);
    UpdateCustomer(); 
    I've just been looking at the Java toolbox and PCML but this seems too limited. You cannot pass more than seven parameters to a procedure and none of those parameters can be passed by value. PCML seems the main way to do it but you pretty much have to tailor your API's for it.

    Anyone know anything else? Perhaps you've tried to solve this problem already. A nudge in the right direction would be greatly appreciated.

    Thanks
    Ben

  • #2
    Re: Best way to call a SRVPGM from Java?

    I think all of the toolbox methods are too simplistic for what I need. Using the toolbox methods I would have to effectively call those API procedures with a separate network request for each. I really want to be able to call a "batch" of procedures to save on network traffic. I also need to be able to set-up the library list before calling the API. This will be different depending on the environment and may have different change request libraries for different developers API changes.

    As a result of all of this I have come to the conclusion that I either need to write a socket server or else use the toolbox to pop entries on a data queue. I like the socket server myself as that's where Java excels. I could use Apache for the iSeries end and write an RPG handler to call the API's.

    I'm surprised nobody else has had to do this?
    Ben

    Comment


    • #3
      Re: Best way to call a SRVPGM from Java?

      You are basically putting a java front end onto a system? Is it supposed to be a web app or standalone java app?
      Your future President
      Bryce

      ---------------------------------------------
      http://www.bravobryce.com

      Comment


      • #4
        Re: Best way to call a SRVPGM from Java?

        Correct. Currently we seem to favour web applications over standalone client apps. This seems to be a general trend across the industry. I was thinking of giving Java WebStart a go as its as easy to deploy as a web app but gives you all the coding flexibility of a desktop app.

        In theory the method of communicating with the API's shouldn't matter depending on if I choose a web app or standalone. I could write it all for a Java WebStart thin client and then re-use the Java code that interfaces with the API's for any web app we have to do.

        Note this is just a proof of concept at the moment.
        Ben

        Comment


        • #5
          Re: Best way to call a SRVPGM from Java?

          If you are on the legacy system with just a normal a 5250 client, how does the system know what library list to load for the specific set of service programs?
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: Best way to call a SRVPGM from Java?

            Currently the service programs run in a subsystem with a bunch of pre-started jobs controlled by a manager job. Requests come in on a data queue and get run by one of the pre-started jobs. Once completed, responses go on a different data queue.

            I have started coding now but I keep changing my mind on how best to do it. I started by writing a stub program to wrap the service program calls. The stub sets up the library list and makes multiple procedure calls. I now need a way of passing some quite complex data relationships back and forth. I'm thinking XML is the best way to go as I won't be restricted to hard coded array sizes and it keeps the client and server loosely coupled.

            At the moment I'm just calling my stub program using PCML but I have scalability and performance concerns. It takes a couple of seconds to come back with a response and its not really doing anything at the moment. I think in time I might use something more like the existing data queue structure. For now I need to concentrate on what data to pass around i.e. XML.

            It's quite an interesting little project. At the moment its more to satisfy my curiosity so I'm doing less than an hour a day.
            Ben

            Comment

            Working...
            X