Skip to Content

XI Attachment and main document MIME sequence

Hi All,

We are doing SRM XI ARIBA PurchaseOrder Integration, everything works fine. Now we want to add a new feature to support attachments. So from SRM XI will be receiving MainXML and Attachment(s)(this can be any type like word, pdf, jpg etc). We are using Receiver SOAP adapter with option of keep attachments.

Now, the problem XI is sending Multipart MIME in sequence as below:


Attachment (WORD, PDF)

MainDocument (XML payload)</b>

when Ariba recives this payload it reads attachment as the first part and rejects the whole message because its not a main payload. And Ariba expects MIME

parts to be presented in sequence like below:



Anybody know how to change the sequence of these mime parts. Are there any settings on the SOAP adapter? etc?

I have refered payload swap bean but I was not quite sure will that help.

Appreciate your help.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 30, 2007 at 10:46 AM

    Hi Laxman,

    I have checked this now.

    No matter how the order in the SXMB_MONI is, the SOAP sender adapter takes the MainPayload as SOAP message and the attachments as SOAP attachments.

    So there is nothing to do here.

    Use the TCPGateway to see the correct order of the SOAP message by yourself. Check this blog:




    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Laxman Molugu

      Thanks Laxman.

      Unfortunately an error appears when I execute the bean: java.lang.LinkageError: Class com/sap/aii/messaging/mo/xmb/XMBMessage violates loader constraints. It fails executing the following line:

      XMBPayload xmbP1 = xmbMsg.getApplicationPayload();

      My complete piece of code is the following:

        AuditMessageKey amk;

        Object obj = inputModuleData.getPrincipalData();

        XIMessage xiMsg = (XIMessage) obj;


        amk = new AuditMessageKey(xiMsg.getMessageId(),AuditDirection.INBOUND);

        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Trying to alter the Mime headers...");


        int numAttPayloads = xiMsg.countAttachments();

        XMBMessage xmbMsg =   xiMsg.getXMBMessage();

        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Bean Version: v5");

        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Found "+numAttPayloads+" attachments...");


        try {

        XMBPayload xmbP1 = xmbMsg.getApplicationPayload(); 

        String appPayloadName = xmbP1.getPayloadName();

        // Re-arranging mime parts: MainDocument to be appeared as the first part.

        for (int i=0; i<numAttPayloads;i++){

        XMBPayload arrPayload = xmbMsg.getPayload(i);

        String arrPayloadName = arrPayload.getPayloadName();




        } catch (Exception e) {

        Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR,"Error executing bean. Error: " + e.getMessage()); 




      Any idea of what might be wrong?

      Thanks a lot for your help,

      David R.

  • Mar 29, 2007 at 09:11 AM

    I have tested with the PayloadSwapBean.

    Usually the MainDocument should be the first MIME part.

    If this not the case, put in the module tab following entry as before the standard module:


    The parameters are:

    swap.keyName payload-name

    swap.keyValue MainDocument



    Add comment
    10|10000 characters needed characters exceeded