cancel
Showing results for 
Search instead for 
Did you mean: 

Size of XI messages processing image files

Former Member
0 Kudos

hi,

I hav a scenario in which XI is picking up images form a database and is sending them to another database.

The JDBC sender adapter in use has a query like select image, file name, file size from table where file name starts with 'a', thus at times the adapter ends up picking multiple images in one go.

When we check the size of the a single XI message payload carrying images as a result of the above adapter, it has been observed to be of double the size of the image being carried. For instance, if the image picked is of size 1MB the size of the XI message payload is shown as 2MB; in the <SAPMessageSizePayload> tag when the message is opened in SXI_MONITOR.

I want to know the reason behind the XI message payload size being double that of the size of the image it carries.

regards,

Diptee

Edited by: diptee s on Dec 18, 2010 11:10 AM

Edited by: diptee s on Dec 18, 2010 11:11 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member181985
Active Contributor
0 Kudos

Hi,

The answers by abhishek is in general correct, when you check messaage size in SXMB_MONI txn under SOAP Header-->Runtime

However headers doesn't constitute extra 1 MB in your case. The reason being JDBC adapter changes binary stream to "hexadecimal encoded", wherein the message generally gets almost doubled.

Check SAP link: http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

Quote in the above link "The binary data for BLOB is hexadecimal encoded."

Check my blog: [SAP XI/PI: Storing BINARIES (Images, PDFs etc.) in the Database (BLOBs) Using JDBC Adapter|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/18494] [original link is broken];

From my blog: We can also do the same thing by configuring a scenario in XI/PI (JDBC to File) by reading the JDBC table. (Remember convert hexadecimal string to binary stream before sending it to File Adapter, we need a java mapping program for this with the below code snippet)

public static byte[] hexStringToByteArray(String s) {
        int len = s.length();
        byte[] data = new byte[len / 2];
        for (int i = 0; i < len; i += 2) {
            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
                                 + Character.digit(s.charAt(i+1), 16));
        }
        return data;
    }

Regards,

Praveen Gujjeti

Edited by: Praveen Gujjeti on Dec 19, 2010 12:50 PM

Former Member
0 Kudos

Hi Praveen,

Thanks a lot for letting me know the cause.

About the code snippet which you have provided it can convert the hexadecimal encoding of the image to binary. However, can the default conversion of the binary stream into hexadecimal by the JDBC adapter be avoided using such code or by any other means? If yes where should this code be implemented? I would like to achieve this so that the reduction in message size can be helpful in reducing the load on the XI server.

regards,

Diptee

Edited by: diptee s on Dec 20, 2010 5:58 AM

Edited by: diptee s on Dec 20, 2010 5:59 AM

former_member181985
Active Contributor
0 Kudos

Hi Diptee,

No, as far as I know. Since your scneario is DB1--> PI --> DB2, there is no need to covert the hexadecimal string to binary as it will be taken care by the receiver JDBC adapter while posting to DB2.

The JDBC adapter is designed to have the following XML structure as response. Assume that Col1 or Col2 is BLOB and then if JDBC adapter accomodates the binary stream, XML becomes invalid/incomplete.

<resultset>

<row>

<column-name1>column-value</ column-name1>

<column-name2>column-value</column-name2>

</row>

</resultset>

Regards,

Praveen Gujjeti

Edited by: Praveen Gujjeti on Dec 20, 2010 10:39 AM

Former Member
0 Kudos

Thanks a lot Praveen,

In that case we will have to restrict the number of images being processed by XI, to improve its performance as far as possible.

Former Member
0 Kudos

Hi Diptee,

What exactly said by Abhishek is the reason for the showing more size of the file in Moni. You can check this as said.

Thanks,

former_member200962
Active Contributor
0 Kudos
I want to know the reason behind the XI message payload size being double that of the size of the image it carries.

Message never is of the size which you send from source....the message has some addiotnal details like header (and some other SOAP document details)....this constitutes the <SAPMessageSizePayload> size... hence you find the difference.

If you have doubt may be you can copy the payload from SXMB_MONI and check what is the size....it would be the size of your original message.

Regards,

Abhishek.