× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



one way would be to use an userspace object.

1. call rpg program
2. rpg: fill userspace object with xml data
3. java: read userspace

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im 
Auftrag von Richard Sankey
Gesendet: Freitag, 14. Juli 2006 16:45
An: rpg400-l@xxxxxxxxxxxx
Betreff: Calling RPG Service Programs that return XML from Java

Hi,

I wonder if someone can help or advise on the best methods to do the 
following...

We have an Java based web-server app that needs to read data, from an 
iSeries, in the form of an XML document (sort of like a web-service). The 
logic to define the data is in RPG programs. The simple solution to me would 
be to call an RPG program, via a stored procedure using JT400, that returns 
XML in a CLOB. The Java to do this is very simple...

  CallableStatement stmt = null;

  //Prepare the statement
  stmt = conn.prepareCall("CALL PROGRAM1(?, ?, ?)");

  // Set parameters.
  stmt.setString(1, sParam1.toUpperCase());
  stmt.setString(2, sParam2.toUpperCase());
  stmt.registerOutParameter(3, Types.CLOB);

  stmt.execute();
  result = stmt.getClob(3);

The problems I can see are...

1) We need to return XML as a parameter. Clob fields seem most appropriate 
but is it possible to write an RPG program that returns a Clob via a stored 
procedure call? JT400 supports clob's fields but does it work with RPG 
programs? I have read/wrote CLOB fields directly to a iSeries physical file 
OK so I know that works.

2) The RPG XML API allows you to write to a IFS file. Is it more efficient 
for the RPG programs to write the XML to a file and then for the Webserver 
app to  FTP/HTTP/direct-read it from the iSeries?

3) Internally, we need procedures to return "mini-DOM's", i.e. small sets of 
XML that are collated into a larger DOM. Once we have used the IBM XML api 
to create a DOM or node set, can I then pass it to another procedure or 
program as a parameter or define it as the return value from a procedure?

Any advice or examples would be greatly appreciated.

Cheers
Rich



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.