cancel
Showing results for 
Search instead for 
Did you mean: 

Proxy to File transfer using the GZIP file transfer

former_member206439
Contributor
0 Kudos

Hi Sdn,

I have requirement where I need to convert the file to GZIP extension and keep it at Application layer.

Can any one please help me how to convet the file to GZIP in file adaptor?

Thanks

Naresh N

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

You can find the option Run Operating System Command After Processing in your receiver Communication channel. See some more details here:

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/frameset.htm

Try typing "gzip %f" or "gzip %F" to see whether full (%F) or relative path (%f) is required. If this works fine, then you can also add "rm %f" to delete the uncompressed file.

Hope this helps,

Greg

former_member206439
Contributor
0 Kudos

If my file path is user/comm/ and file name schema is XXXXXX.xml

What is the command to covert it to GZIP ?

Is it the correct statment ?

gzip user/COMM/XXXXXX.xml

former_member184681
Active Contributor
0 Kudos

If you have a constant file name, you can use it like that: "gzip user/COMM/XXXXXX.xml"

But if not, you can make use of this:

When the operating system command is called, you can specify the file name currently being processed with the following placeholders:

%f (file name)

%F (absolute file name including path)

Greg

former_member206439
Contributor
0 Kudos

No My file is not constant .

It vary depending on the message ID.

former_member184681
Active Contributor
0 Kudos

Then you should definitely use the %f or %F variables defined by PI

former_member206439
Contributor
0 Kudos
gzip /UFACE/NNN/out/KK/XXXX/enc/Create_%message_id%.xml

I kept above command in my PI OS command screen i did't found any difference why?

Edited by: Naresh Nelapatla on Feb 9, 2012 8:37 PM

former_member184681
Active Contributor
0 Kudos

Because you really need to use %F for the file name. So type "gzip %F" as the OS command and test again.

former_member206439
Contributor
0 Kudos

What is the UNZIP command for GZIP file ?

former_member184681
Active Contributor
0 Kudos

Hi,

It's GUNZIP. See here for more:

http://www.gzip.org/

Hope this helps,

Greg

former_member206439
Contributor
0 Kudos

Thanks for the Help.

In the Sender File Adaptor .

The file type is in .GZIP format .

I have to pick the file and UNZIP it and process the file to PROXY.

FOr this I have to GUNZIP in before processing or after processing?

Edited by: Naresh Nelapatla on Feb 14, 2012 5:08 PM

Answers (2)

Answers (2)

roger_alluivall
Participant
0 Kudos

please, find below a lonk to a module I have developed to zip and unzip messages using gzip:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/04/29/module-payloadgzipbean-zip-and-un...

former_member184681
Active Contributor
0 Kudos

Hi Naresh,

You could try with this adapter module PayloadZipBean:

http://help.sap.com/saphelp_nw73/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm

I'm not really sure if you can get the gzip file, or only zip. But this might be a nice point to start.

Hope this helps,

Greg

former_member206439
Contributor
0 Kudos

I think this option is for the normal ZIP.

I am looking for the specific GZIP format.

former_member184681
Active Contributor
0 Kudos

I think this option is for the normal ZIP.

Honestly I was afraid this could be true.

So I think there is no other option than to create your own adapter module. Find a step-by-step guide on how to create adapter modules here:

http://wiki.sdn.sap.com/wiki/display/NWTech/CustomAdapterModuleDevelopment-SAPPI+7.1

And a Java class that will help you compress the data stream with GZIP:

http://docs.oracle.com/javase/1.5.0/docs/api/java/util/zip/GZIPOutputStream.html

Hope this helps,

Greg

Ryan-Crosby
Active Contributor
0 Kudos

Hi Naresh,

For this requirement you could use a java mapping and use the GZIPOutputStream in java.util.zip to compress the payload. Copy the InputStream to the GZIPOutputStream which inherits from OutputStream and then just zip the contents using finish() and then close() the stream.

Regards,

Ryan Crosby

former_member206439
Contributor
0 Kudos

Hi Ryan,

Could you please let me know where we can do the Java Mapping.

I am new to PI

Thanks

Naresh

Ryan-Crosby
Active Contributor
0 Kudos

Hi Naresh,

The usage of java mapping requires that you use interface determination so you'd have to create that in the ESR. But in order to create the interface determination you'd first have to write the java code for the mapping and then compile it into a .jar file. Once you finish that you can import the .jar archive in the ESR and finish the interface determination. Then you simply reference the interface determination in your PI configuration.

Regards,

Ryan Crosby

Ryan-Crosby
Active Contributor
0 Kudos

Hi Naresh,

Also the easiest way to do the gzip compression if you are using the file adapter is to simply run an OS command line for gzipping the file after the message has been processed. I suppose I wasn't paying full attention and read the other reply before thinking about the solution. This of course is a much easier way to achieve the same outcome.

Regards,

Ryan Crosby

former_member206439
Contributor
0 Kudos

OS command line for gzipping the file?

I got the location where we can write the OS command

Can you please let me know the command I have to write to ZIP the file.

Where we can write this command ?

Edited by: Naresh Nelapatla on Feb 9, 2012 8:02 PM

Ryan-Crosby
Active Contributor
0 Kudos

Hi Naresh,

In the communication channel for your receiver (file adapter) you click on the processing tab and there is a spot where it says in bold "Run Operating System Command After Message Processing" and this is where you can place the gzip command.

Regards,

Ryan Crosby

former_member206439
Contributor
0 Kudos

Can you please let me know the command to convert it to Gzip?