DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

How to modify content-type header of the root part of MTOM message

  • 1.  How to modify content-type header of the root part of MTOM message

    Posted Wed November 17, 2021 09:20 AM

    When datapower creates MTOM message it populates the content-type header of root part as

    Content-Type: application/xop+xml; type="application/soap+xml"

    I want to add the charset=UTF-8 to this header. When I try to modify the content header changes are reflected in the overall content-type header but not inside root.



    #DataPower
    #Support
    #SupportMigration


  • 2.  RE: How to modify content-type header of the root part of MTOM message
    Best Answer

    Posted Thu November 18, 2021 06:26 PM

    Hi,

    can you share any insight on how do you create the MTOM message?

    --HP



    #DataPower
    #Support
    #SupportMigration


  • 3.  RE: How to modify content-type header of the root part of MTOM message
    Best Answer

    Posted Sun November 21, 2021 10:56 AM

    I create MTOM messages using mtom policy used by store://mtom.xsl. I provide base64 contents of the attachment inside <Attachment> element and give it's reference in MTOM policy.


    Thanks

    Shubham



    #DataPower
    #Support
    #SupportMigration


  • 4.  RE: How to modify content-type header of the root part of MTOM message
    Best Answer

    Posted Mon November 22, 2021 03:40 PM

    Try to set var://service/set-response-header/Content-Type or var://service/set-request-header/Content-Type to value of your choice after the mtom.xsl xform depending on the direction of your processing.

    --HP



    #DataPower
    #Support
    #SupportMigration


  • 5.  RE: How to modify content-type header of the root part of MTOM message
    Best Answer

    Posted Wed November 24, 2021 08:06 AM

    I tried that but that sets the header at the envelope level but does not modify the content-type of root part.


    --Shubham



    #DataPower
    #Support
    #SupportMigration


  • 6.  RE: How to modify content-type header of the root part of MTOM message
    Best Answer

    Posted Thu November 25, 2021 10:14 AM

    Can you please specify what you mean by "envelope level" and "root part"? I tested the configuration and got the following result:


    Without setting var://service/set-response-header/Content-Type


    --5a5fe9c3-b910-4784-a321-b239e99a3ae7

    Content-ID: <root>

    Content-Type: application/xop+xml; type="application/soap+xml"

    Content-Transfer-Encoding: binary


    <?xml version="1.0" encoding="UTF-8"?>

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exmp="http://example.com">

    <soapenv:Header/>

    <soapenv:Body>

    <exmp:element1>some text</exmp:element1>

    <exmp:element2>some more text</exmp:element2>

    <exmp:attachment><xop:Include href="cid:mytextpart" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></exmp:attachment>

    </soapenv:Body>

    </soapenv:Envelope>

    --5a5fe9c3-b910-4784-a321-b239e99a3ae7

    Content-ID: <mytextpart>

    Content-Transfer-Encoding: binary

    Content-Type: text/plain


    <binary content>

    --5a5fe9c3-b910-4784-a321-b239e99a3ae7--


    With var://service/set-response-header/Content-Type


    --d867412b-08c3-4ef1-8bd4-b239e99abc8d

    Content-ID: <root>

    Content-Type: 'application/xop+xml; charset=utf-8; type="application/soap+xml"'

    Content-Transfer-Encoding: binary


    <?xml version="1.0" encoding="UTF-8"?>

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exmp="http://example.com">

    <soapenv:Header/>

    <soapenv:Body>

    <exmp:element1>some text</exmp:element1>

    <exmp:element2>some more text</exmp:element2>

    <exmp:attachment><xop:Include href="cid:mytextpart" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></exmp:attachment>

    </soapenv:Body>

    </soapenv:Envelope>

    --d867412b-08c3-4ef1-8bd4-b239e99abc8d

    Content-ID: <mytextpart>

    Content-Transfer-Encoding: binary

    Content-Type: text/plain


    <binary content>

    --d867412b-08c3-4ef1-8bd4-b239e99abc8d--



    --HP



    #DataPower
    #Support
    #SupportMigration


  • 7.  RE: How to modify content-type header of the root part of MTOM message
    Best Answer

    Posted Mon November 29, 2021 01:59 PM