How to send documents to a Web Server outside the firewall using LANSA Integrator

Date:7 March 2005
Product/Release:LANSA Integrator
Abstract:How can I send documents to a Web Server outside the firewall
Submitted By:LANSA Services
Last Review:November 2010

Description:

I have developed a Web site that allows farmers to log on to their own account and view information about grain deliveries, payments, details of nearest storage points etc. Also on the Web site is an ASP that builds a list of documents that are held on a server that is within the company's DMZ. The user can then select a document which could be a CSV file or a PDF and the file is then sent from the server within the DMZ to the IIS Web server that is outside the DMZ so that the user can open up the document using Excel or Adobe Acrobat.

I want to replace the ASP with a LANSA function with additional selection criteria etc. I have written a function using LANSA Integrator that builds a list of documents based on the entered selection criteria with the document reference as a hyperlink.

What I want to do now is when the user clicks on the hyperlink the document is opened with the appropriate software. Can I do this without having to FTP the file from the file server to the Web server? This is probably possible using LANSA Integrator but I cannot find a JSM service that fits the bill.

Solution:

LANSA Integrator provides a HTTP content handler called the InboundFile Handler. The name is a bit misleading as you can use this handler to not only receive but also send files using HTTP.

You should be able use this handler. From the Web page you will have to do a HTTP POST to JSMProxy (use a <FORM> TAG). The URL for JSMProxy can have parameters (for example: /cgi-bin/jsmproxy?GETFILE+FILEREF(999999) where field FILEREF will be populated with 999999) The JSMProxy program will redirect the request to JSMDirect on the inner box where the file resides. The JSMDirect Service name will be used to initiate the LANSA function with the associated logic for retrieving the file.

In the LANSA function, Open JSM, load the HTTPCLIENT service and use the InboundFile Handler to do a SEND with the associated file path, then close JSM (do not unload the service). The file will be directed as the response to the HTTP request.