on 11-22-2007 9:03 AM
Hi friends,
sender Legacy system is sending files in .Zip format.
how the adapter is going to process those files?
what configurations r to be needed in adapter configuration?
& also for processing of .pdf files what configurations should be done?
thanks in advance.
shiva.
i have a better solution
use standard modules provided by sap itself.
Zip or Unzip your Payload with the new PayloadZipBean module of the XI Adapter Framework - /people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework
/people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiva,
the adapter can process the file. At mapping time you need to dezip the msg. An example in java:
import java.io.*;
import java.util.Map;
import java.util.zip.*;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
public class DecompressMapping implements StreamTransformation {
/* (non-Javadoc)
* @see com.sap.aii.mapping.api.StreamTransformation#setParameter(java.util.Map)
*/
public void setParameter(Map arg0) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.sap.aii.mapping.api.StreamTransformation#execute(java.io.InputStream, java.io.OutputStream)
*/
public void execute(InputStream arg0, OutputStream arg1)
throws StreamTransformationException {
try {
int len;
byte[] buf = new byte[8192];
boolean first_iter = true;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while((len = arg0.read(buf) ) != -1)
{
if (first_iter)
{
if ((buf[0] != 'P') || (buf[1] != 'K'))
{
arg1.write(buf, 0, len);
while((len = arg0.read(buf) ) != -1)
{
arg1.write(buf, 0, len);
}
return;
}
else
{
first_iter = false;
}
}
baos.write(buf, 0, len);
}
byte[] in_data = baos.toByteArray();
ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(in_data));
ZipEntry ze = zis.getNextEntry();
if (ze != null)
{
while((len = zis.read(buf) ) != -1)
{
arg1.write(buf, 0, len);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Regards,
Udo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.