Submitted by Syd Nicholson on Tue, 01/23/2007 - 00:00
Forums

I need to copy documents from the IFS in one iSeries system to the IFS in another. This is an archiving application - documents over a specified age are to be copied to an archive machine.

The process needs to be automatic and will run in a batch job on the iSeries.

Documents that exist on the target machine should not be copied again, unless that document has changed.

I could use FTP to do the transfer - however - I was wondering if there might be a more elegant solution using IceBreak and some batch oriented .asp programs.

The documents can take any form (eg. images, word docs, spreadsheets, text, pdf, etc.).

Gaining access to the IFS using APIs does not present any problems, and, with IceBreak on both systems, it should be possible to achieve two way communication using XML. This has an advantage over FTP.

Is it possible - using IceBreak - to do an automated 'HTTP get' of a document and then save that document in the appropriate IFS directory. I may be necessary for the IceBreak program to create the required directory/sub-directories using the IFS APIs and i5/OS commands.

If any of you techy guys have any ideas on how this might be achieved I would be very interested to know them.

Many thanks in advance
Regards
Syd

Niels Liisberg

Wed, 01/24/2007 - 00:00

Hi Syd;

Consider this only if it is an intranet solution. The following has security flaws... anyways:

One solution might be to utilize the "upload" feature from a webservice. the trice is to make an upload form like the upload tutorial giving the file name can be viven dynamically as the "filename" attribute in the form. the data itself is binary but you post it the "attachment" contents type from the httprequest.

Sorry I'm a nerd ;-) ... but this works

Niels 

Originally Posted by Niels Liisberg:

"Hi Syd;

Consider this only if it is an intranet solution. The following has security flaws... anyways:

One solution might be to utilize the "upload" feature from a webservice. the trice is to make an upload form like the upload tutorial giving the file name can be viven dynamically as the "filename" attribute in the form. the data itself is binary but you post it the "attachment" contents type from the httprequest.

Sorry I'm a nerd ;-) ... but this works

Niels"


Sorry Neils,

I don't understand your reply.

The form <input> element implies that there is a browser on a PC somewhere. If an "upload" form is used - does this not require a PC with a browser to process the upload. I don't understand how I can automate this and avoid using an intermediate PC. Using an intermediate PC adds a degree of weakness and unreliability to the application.

The situation I am working in consists of two iSeries on an intranet. Files are to be automaticaly passed from one to the other based on their last access date. I can get this information using 'stat' on the IFS file.

I could set up a Java application to do this - using sockets. A base Java application can start a thread, open a socket to the corresponding application on the target machine, open a stream and stream the file to the target box. The target application then writes the file to the target IFS directory direct from the stream. This involves quite a lot of work, and I would rather write in RPG and not Java. I feel that there may be a more efficient and productive way to achieve the same result using IceBreak.

Regards
Syd

Originally Posted by Syd Nicholson: 

"Sorry Neils,

I don't understand your reply.

The form <input> element implies that there is a browser on a PC somewhere...."


No . When you use httpRequest, you simply POST a upload form with the IFS file as a content.

Set on "trace" for your server and runt the upload tutoral. The examin the trace and see the format of an upload ....

Alos - search google to find an exaple of the upload form layout

Niels

Sorry once again Niels - perhaps I am just exeptionally thick, or too much of a nerd on 'normal' RPG programming.

I am trying to get a picture a picture in my head - I always need pictures in my head before I can understand anything - a 'map' of the processing invoved.

Lets start with the target system:- it is running IceBreak and on request it will load a .asp program to process the form containing the files to be uploaded. This program uses information in the Form to save the files to their appropriate directories.

Now to the source system:- This system uses a batch job that wakes up at regular intervals to analyse the IFS, and, if required sends files to the target sytem. This batch job is a .asp program. The job biulds the form as a string and sends this using 'POST' with the HttpRequest() function to the target system URL. This triggers a response from the target system to receive and process the data in the form.

Is this mechanism correct, or am I barking up the wrong tree?

Regards
Syd

Syd,

I think what Niels is trying to tell you is you'll have to do the following:

THE ARCHIVE MACHINE:
Create an ASP-program that processes uploaded file(s). It will save an uploaded file to the IFS. Then in the response back to the 'requester/poster' you'll send a status code/information if everything went ok or not.

THE SOURCE MACHINE:
Create an ASP-program that somehow is run scheduled. This program will used the HttpRequest with the 'POST' parameter to upload the file to be sent to the archive system. Check the response from the archive machine to see if the upload was successfull or not.
Best regards,

John Foldager
www.izone.dk
www.icebreakforum.org