Topic
  • 19 replies
  • Latest Post - ‏2015-10-16T09:48:50Z by Daviiid
vijaitly
vijaitly
4 Posts

Pinned topic Adding Attachment to a SOAP response and converting it into MTOM

‏2013-07-10T12:52:44Z |

Hi,

I am developing a WSP in DataPower which receives a XML message as response. I have to convert the XML message into a SOAP response and add an attachment to it. After adding the attachment the SOAP with attachment shall be converted into MTOM format and passed.

I am able to convert the request to a SOAP message by building a wrapper around it. Could you please guide me in achieving the remaining of the requirement i.e., adding the payload and converting it into MTOM.

I tried using the xml2swa.xsl from https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014878439 but it is not helping out as I am using XB60 and it does not have a XML Gateway. 

Please help

VJ

Updated on 2013-07-11T20:56:05Z at 2013-07-11T20:56:05Z by vijaitly
  • HermannSW
    HermannSW
    6201 Posts
    ACCEPTED ANSWER

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2013-07-12T08:54:55Z  

    Hi,

    find attached a MPGW service export of the service you referred to.

    I just imported the XML FW service, created new MPGW with http://1.2.3.4 backend, reused binAttach policy, and just added a setvar action setting var://service/mpgw/skip-backside to 1 in order to have a loopback MPGW.

    Stylesheet "store:///mtom.xsl" is used to convert an inlined, base64 encoded (binary) file to MTOM.

    If you already generate the attachment, you do not need that anymore.

    You just have to insert <xop:Include href="cid:nonXML"/> for the sample below somewhere in the root part document.

    $ curl --data-binary @some_soap.xml http://beast:4903


    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-Type: application/soap+xml
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-ID: <nonXML>
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <tii>  This is it. </tii>
    </env:Body>
    </env:Envelope>

    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3--
    $

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Attachments

  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2013-07-12T08:54:55Z  

    Hi,

    find attached a MPGW service export of the service you referred to.

    I just imported the XML FW service, created new MPGW with http://1.2.3.4 backend, reused binAttach policy, and just added a setvar action setting var://service/mpgw/skip-backside to 1 in order to have a loopback MPGW.

    Stylesheet "store:///mtom.xsl" is used to convert an inlined, base64 encoded (binary) file to MTOM.

    If you already generate the attachment, you do not need that anymore.

    You just have to insert <xop:Include href="cid:nonXML"/> for the sample below somewhere in the root part document.

    $ curl --data-binary @some_soap.xml http://beast:4903


    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-Type: application/soap+xml
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-ID: <nonXML>
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <tii>  This is it. </tii>
    </env:Body>
    </env:Envelope>

    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3--
    $

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Attachments

  • vijaitly
    vijaitly
    4 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2013-07-19T07:47:06Z  
    • HermannSW
    • ‏2013-07-12T08:54:55Z

    Hi,

    find attached a MPGW service export of the service you referred to.

    I just imported the XML FW service, created new MPGW with http://1.2.3.4 backend, reused binAttach policy, and just added a setvar action setting var://service/mpgw/skip-backside to 1 in order to have a loopback MPGW.

    Stylesheet "store:///mtom.xsl" is used to convert an inlined, base64 encoded (binary) file to MTOM.

    If you already generate the attachment, you do not need that anymore.

    You just have to insert <xop:Include href="cid:nonXML"/> for the sample below somewhere in the root part document.

    $ curl --data-binary @some_soap.xml http://beast:4903


    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-Type: application/soap+xml
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-ID: <nonXML>
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <tii>  This is it. </tii>
    </env:Body>
    </env:Envelope>

    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3--
    $

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Thanks a lot Hermann!!. 

    I was trying the same way, but was missing to add the magical touch in the result action.

    Thanks Again!! :)

  • Daviiid
    Daviiid
    348 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-07-23T16:57:06Z  
    • HermannSW
    • ‏2013-07-12T08:54:55Z

    Hi,

    find attached a MPGW service export of the service you referred to.

    I just imported the XML FW service, created new MPGW with http://1.2.3.4 backend, reused binAttach policy, and just added a setvar action setting var://service/mpgw/skip-backside to 1 in order to have a loopback MPGW.

    Stylesheet "store:///mtom.xsl" is used to convert an inlined, base64 encoded (binary) file to MTOM.

    If you already generate the attachment, you do not need that anymore.

    You just have to insert <xop:Include href="cid:nonXML"/> for the sample below somewhere in the root part document.

    $ curl --data-binary @some_soap.xml http://beast:4903


    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-Type: application/soap+xml
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3
    Content-ID: <nonXML>
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <tii>  This is it. </tii>
    </env:Body>
    </env:Envelope>

    --e5b7c543-5c5f-4608-a7bc-f71d70a2c7e3--
    $

     

    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Hello

    How add a new Http Content-Type Header information I need to add, for example, start="tutu"

    wihtin hermann stylesheet, datapower generated Content-Type: multipart/related; boundary="1798762e-1d55-41a1-be54-62ef2e088f93"; type="application/soap+xml"

    And i want  Content-Type: multipart/related; boundary="1798762e-1d55-41a1-be54-62ef2e088f93"; type="application/soap+xml"; start="tutu"

     

    Updated on 2015-07-23T16:59:40Z at 2015-07-23T16:59:40Z by Daviiid
  • Daviiid
    Daviiid
    348 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-07-25T12:54:44Z  
    • Daviiid
    • ‏2015-07-23T16:57:06Z

    Hello

    How add a new Http Content-Type Header information I need to add, for example, start="tutu"

    wihtin hermann stylesheet, datapower generated Content-Type: multipart/related; boundary="1798762e-1d55-41a1-be54-62ef2e088f93"; type="application/soap+xml"

    And i want  Content-Type: multipart/related; boundary="1798762e-1d55-41a1-be54-62ef2e088f93"; type="application/soap+xml"; start="tutu"

     

    Hermann ? An idea ? I guess yes :-)

  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-07-25T14:04:43Z  
    • Daviiid
    • ‏2015-07-25T12:54:44Z

    Hermann ? An idea ? I guess yes :-)

    Hi Daviid,

    I have an idea:
    http://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.0.0/com.ibm.dp.xi.doc/set-mime-header_element.html


    But I was not able to modify Content-Type header you are interested in with it:

    < HTTP/1.1 200 OK
    < X-Backside-Transport: FAIL FAIL
    < Connection: Keep-Alive
    < Transfer-Encoding: chunked
    < Content-Type: multipart/related; boundary="a5608e93-fde0-401f-976b-1d073ff15b61"; type="application/soap+xml"
    < 
    
    
    --a5608e93-fde0-401f-976b-1d073ff15b61
    Content-Type: application/soap+xml
    Content-Transfer-Encoding: binary
    
    
    --a5608e93-fde0-401f-976b-1d073ff15b61
    Content-ID: <nonXML>
    Content-Transfer-Encoding: binary
    
    tet
    --a5608e93-fde0-401f-976b-1d073ff15b61--
    * Connection #0 to host dp3-l3 left intact
    * Closing connection #0
    $ 
    

     

    Please open a question type PMR in order to get your question answered.


    Hermann.

  • Daviiid
    Daviiid
    348 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-07-31T15:24:17Z  
    • HermannSW
    • ‏2015-07-25T14:04:43Z

    Hi Daviid,

    I have an idea:
    http://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.0.0/com.ibm.dp.xi.doc/set-mime-header_element.html


    But I was not able to modify Content-Type header you are interested in with it:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">< HTTP/1.1 200 OK < X-Backside-Transport: FAIL FAIL < Connection: Keep-Alive < Transfer-Encoding: chunked < Content-Type: multipart/related; boundary="a5608e93-fde0-401f-976b-1d073ff15b61"; type="application/soap+xml" < --a5608e93-fde0-401f-976b-1d073ff15b61 Content-Type: application/soap+xml Content-Transfer-Encoding: binary --a5608e93-fde0-401f-976b-1d073ff15b61 Content-ID: <nonXML> Content-Transfer-Encoding: binary tet --a5608e93-fde0-401f-976b-1d073ff15b61-- * Connection #0 to host dp3-l3 left intact * Closing connection #0 $ </pre>

     

    Please open a question type PMR in order to get your question answered.


    Hermann.

    Hi Herman

    <dp:set-request-header name="'Content-Type'" value="'application/xop+xml; charset=UTF-8; type=&quot;application/soap+xml&quot;'"/>
    


    This command add new value in Mime Content-Type Header value (start-info) and change type value (application/xop+xml)

    HTTP/1.1 200 OK
    X-Backside-Transport: FAIL FAIL
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    Content-Type: multipart/related; boundary="5d91a24c-2b19-4651-b17b-c0c3b434878e";start-info="application/soap+xml"; type="application/xop+xml"
    
    
    --5d91a24c-2b19-4651-b17b-c0c3b434878e
    Content-Type: application/xop+xml; charset=UTF-8; type="application/soap+xml"
    Content-Transfer-Encoding: binary
    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ns="http://smabtp.fr/service/internet/DownloadFichiersService/1.0"><soap:Header/><soap:Body><ns:getFilesByIdDemandResponse><fichier><content><xop:Include href="cid:3439d21cab644f3fbbfbef911b7c540a" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></content><nomFichier>monfichs.pdf</nomFichier></fichier></ns:getFilesByIdDemandResponse></soap:Body></soap:Envelope>
    
    
    --5d91a24c-2b19-4651-b17b-c0c3b434878e
    Content-Type: application/octetstream
    Content-ID: < 3439d21cab644f3fbbfbef911b7c540a>
    Content-Transfer-Encoding: binary
    
    test
    
    

    in the rfc 2387 it indicates that start and start-info header are optionnals. So this http mime header are defined. 

    Updated on 2015-07-31T16:09:49Z at 2015-07-31T16:09:49Z by Daviiid
  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-03T08:35:45Z  

    Thanks for the update,

    Hermann

    (

    My 1st ever posting with Opera Mini web browser, HTML view is the trick

    )
  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-10T18:41:04Z  
    • HermannSW
    • ‏2015-08-03T08:35:45Z

    Thanks for the update,

    Hermann

    (

    My 1st ever posting with Opera Mini web browser, HTML view is the trick

    )

    Hi Hermann,

     

    I have the same requirement I did try the same code, but for some reason Content-ID are not being set properly. 

     

     

    This is response I am getting

     

    --05df53a2-bf78-4283-9493-6ebccf78d65c
    Content-Type: text/xml; charset=UTF-8
    Content-Transfer-Encoding: binary
    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
    --05df53a2-bf78-4283-9493-6ebccf78d65c
    Content-ID: 
    <ebms2-payload@127.0.0.1>
    Content-Transfer-Encoding: binary
    <test>
    
    --05df53a2-bf78-4283-9493-6ebccf78d65c--
    

     

    This is the output I am expecting it.

    POST / HTTP/1.1
    SOAPAction: "ebXML"
    Content-Type: multipart/related; type="text/xml"; boundary=MIME_boundary; 
            start=7a4cd22e-d0a9-4d2e-beb3-6746fcfba97cebxml-Header
    
    
    --MIME_boundary
    Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97cebxml-Header>
    Content-Type: text/xml
    
    <?xml version="1.0" encoding="utf-8" ?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
    --MIME_boundary
    Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1>
    Content-Type: application/xml
    <test> 
    --MIME_boundary--
    

     

    The XSL I am using:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp">
            <dp:input-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/>
            <xsl:template match="/">
                    <xsl:variable name="soap">
                            <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope>
                    </xsl:variable>
                    <dp:set-variable name="'var://context/swa'" value="$soap"/>
                    <dp:set-http-request-header name="'Content-ID'" value="'messagepackage@ibm.com'"/>
                    <dp:set-http-request-header name="'Content-Type'" value="'text/xml; charset=UTF-8'"/>
                    <dp:set-http-request-header name="'Content-Transfer-Encoding'" value="'binary'"/>
                    <dp:freeze-headers/>
                    <!--<dp:set-http-request-header name="'Content-Type'" value="'application/soap+xml'"/>-->
                    <xsl:variable name="v" select="'attachment://swa/cid:ebms2-payload@127.0.0.1'"/>
                    <dp:url-open target="{$v}" data-type="base64" response="ignore">
                            <xsl:value-of select="dp:binary-encode(/object/message/node())"/>
                    </dp:url-open>
            </xsl:template>
    </xsl:stylesheet>
    

    Can you please tell me where I am doing it wrong?

    Updated on 2015-08-10T18:41:24Z at 2015-08-10T18:41:24Z by Kumar_Y
  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-11T10:11:42Z  
    • Kumar_Y
    • ‏2015-08-10T18:41:04Z

    Hi Hermann,

     

    I have the same requirement I did try the same code, but for some reason Content-ID are not being set properly. 

     

     

    This is response I am getting

     

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr">--05df53a2-bf78-4283-9493-6ebccf78d65c Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope> --05df53a2-bf78-4283-9493-6ebccf78d65c Content-ID: <ebms2-payload@127.0.0.1> Content-Transfer-Encoding: binary <test> --05df53a2-bf78-4283-9493-6ebccf78d65c-- </pre>

     

    This is the output I am expecting it.

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr">POST / HTTP/1.1 SOAPAction: "ebXML" Content-Type: multipart/related; type="text/xml"; boundary=MIME_boundary; start=7a4cd22e-d0a9-4d2e-beb3-6746fcfba97cebxml-Header --MIME_boundary Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97cebxml-Header> Content-Type: text/xml <?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope> --MIME_boundary Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1> Content-Type: application/xml <test> --MIME_boundary-- </pre>

     

    The XSL I am using:

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr"><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" xmlns:dp="http://www.datapower.com/extensions" extension-element-prefixes="dp"> <dp:input-mapping href="store:///pkcs7-convert-input.ffd" type="ffd"/> <xsl:template match="/"> <xsl:variable name="soap"> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Body><dummySOAPnode/></env:Body></env:Envelope> </xsl:variable> <dp:set-variable name="'var://context/swa'" value="$soap"/> <dp:set-http-request-header name="'Content-ID'" value="'messagepackage@ibm.com'"/> <dp:set-http-request-header name="'Content-Type'" value="'text/xml; charset=UTF-8'"/> <dp:set-http-request-header name="'Content-Transfer-Encoding'" value="'binary'"/> <dp:freeze-headers/> <!--<dp:set-http-request-header name="'Content-Type'" value="'application/soap+xml'"/>--> <xsl:variable name="v" select="'attachment://swa/cid:ebms2-payload@127.0.0.1'"/> <dp:url-open target="{$v}" data-type="base64" response="ignore"> <xsl:value-of select="dp:binary-encode(/object/message/node())"/> </dp:url-open> </xsl:template> </xsl:stylesheet> </pre>

    Can you please tell me where I am doing it wrong?

    In order to get  

    Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1>
    

    in attachment, change

    <xsl:variable name="v" select="'attachment://swa/cid:ebms2-payload@127.0.0.1'"/>
    

    to

    <xsl:variable name="v" select="'attachment://swa/cid:7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1'"/>
    


    Hermann.

    Updated on 2015-08-11T10:13:48Z at 2015-08-11T10:13:48Z by HermannSW
  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-11T14:54:53Z  
    • HermannSW
    • ‏2015-08-11T10:11:42Z

    In order to get  

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1> </pre>

    in attachment, change

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr"><xsl:variable name="v" select="'attachment://swa/cid:ebms2-payload@127.0.0.1'"/> </pre>

    to

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr"><xsl:variable name="v" select="'attachment://swa/cid:7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1'"/> </pre>


    Hermann.

    Hi Hermann,

     

    Also how to get these values ?

    Content-Type: multipart/related; type="text/xml"; boundary=MIME_boundary; 
            start=7a4cd22e-d0a9-4d2e-beb3-6746fcfba97cebxml-Header
    

    I thought content-id can be any value. Can we set any dynamic value rather giving static value everytime?

    Also  why when I am setting the value like why it is not working?

     <dp:set-http-request-header name="'Content-ID'" value="'messagepackage@ibm.com'"/>
    

     

    Updated on 2015-08-11T22:45:23Z at 2015-08-11T22:45:23Z by Kumar_Y
  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-12T15:07:48Z  
    • HermannSW
    • ‏2015-08-11T10:11:42Z

    In order to get  

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">Content-ID: <7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1> </pre>

    in attachment, change

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr"><xsl:variable name="v" select="'attachment://swa/cid:ebms2-payload@127.0.0.1'"/> </pre>

    to

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr"><xsl:variable name="v" select="'attachment://swa/cid:7a4cd22e-d0a9-4d2e-beb3-6746fcfba97c__body1'"/> </pre>


    Hermann.

    Hi hermann,

     

    I think example you gave for how to convert to SWA for single MIME right?

     

    Can you please explain the same for multi-part split?

  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-13T07:26:40Z  
    • Kumar_Y
    • ‏2015-08-11T14:54:53Z

    Hi Hermann,

     

    Also how to get these values ?

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr">Content-Type: multipart/related; type="text/xml"; boundary=MIME_boundary; start=7a4cd22e-d0a9-4d2e-beb3-6746fcfba97cebxml-Header </pre>

    I thought content-id can be any value. Can we set any dynamic value rather giving static value everytime?

    Also  why when I am setting the value like why it is not working?

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr"> <dp:set-http-request-header name="'Content-ID'" value="'messagepackage@ibm.com'"/> </pre>

     

    Please use <dp:set-request-header> as Daviid did show that it works:
    http://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.0.0/com.ibm.dp.xi.doc/set-request-header_element.html

    2nd argument is xs:string, so you can just pass a XSLT variable containing dynamic string data.


    Hermann.

    Updated on 2015-08-13T07:26:56Z at 2015-08-13T07:26:56Z by HermannSW
  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-14T14:53:09Z  
    • HermannSW
    • ‏2015-08-13T07:26:40Z

    Please use <dp:set-request-header> as Daviid did show that it works:
    http://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.0.0/com.ibm.dp.xi.doc/set-request-header_element.html

    2nd argument is xs:string, so you can just pass a XSLT variable containing dynamic string data.


    Hermann.

    Hi Hermann,

     

    This part is not working for me.

     

    Transfer-Encoding: chunked
    Content-Type: multipart/related; boundary="5d91a24c-2b19-4651-b17b-c0c3b434878e";start-info="application/soap+xml"; type="application/xop+xml"
    

    Not sure how david did this?

  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-19T14:54:55Z  
    • Kumar_Y
    • ‏2015-08-14T14:53:09Z

    Hi Hermann,

     

    This part is not working for me.

     

    <pre class="html dw" data-editor-lang="js" data-pbcklang="html" dir="ltr">Transfer-Encoding: chunked Content-Type: multipart/related; boundary="5d91a24c-2b19-4651-b17b-c0c3b434878e";start-info="application/soap+xml"; type="application/xop+xml" </pre>

    Not sure how david did this?

    Hi Hermann,

     

    Can you please advise for the problem I am facing?

  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-19T16:34:30Z  
    • Kumar_Y
    • ‏2015-08-19T14:54:55Z

    Hi Hermann,

     

    Can you please advise for the problem I am facing?

    There are too many variables (stylesheet, config settings), please attach a small sample export and instructions on what you want to do, and what is different to what you want.


    Hermann.

  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-19T16:36:35Z  
    • HermannSW
    • ‏2015-08-19T16:34:30Z

    There are too many variables (stylesheet, config settings), please attach a small sample export and instructions on what you want to do, and what is different to what you want.


    Hermann.

    Hi Hermann,

     

    I am using the same export you shared in the forum. The using the code which I have attached here. I haven't changed anything except the SOAP part.

  • Kumar_Y
    Kumar_Y
    382 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-20T22:15:25Z  
    • HermannSW
    • ‏2015-08-19T16:34:30Z

    There are too many variables (stylesheet, config settings), please attach a small sample export and instructions on what you want to do, and what is different to what you want.


    Hermann.

    Here is sample config

    Attachments

    Updated on 2015-08-20T22:16:20Z at 2015-08-20T22:16:20Z by Kumar_Y
  • HermannSW
    HermannSW
    6201 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-08-22T15:02:51Z  
    • Kumar_Y
    • ‏2015-08-20T22:15:25Z

    Here is sample config

    Hi,

    what is missing?

    You can "see" the Content-Type 4 lines below HTTP 200 response when using curl's "-v" verbose option:

    $ curl --data-binary "test" http://dp3-l3:4903 -v
    * About to connect() to dp3-l3 port 4903 (#0)
    *   Trying 9.152.92.61... connected
    * Connected to dp3-l3 (9.152.92.61) port 4903 (#0)
    > POST / HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
    > Host: dp3-l3:4903
    > Accept: */*
    > Content-Length: 4
    > Content-Type: application/x-www-form-urlencoded

    < HTTP/1.1 200 OK
    < X-Backside-Transport: FAIL FAIL
    < Connection: Keep-Alive
    < Transfer-Encoding: chunked
    < Content-Type: multipart/related; boundary="a87da0fa-8397-4e21-82ba-d0627a4295a6"; type="application/x-www-form-urlencoded"


    --a87da0fa-8397-4e21-82ba-d0627a4295a6
    Content-Type: application/x-www-form-urlencoded
    Content-Transfer-Encoding: binary

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://www.oasis-open.org/committees/ebxml-msg/schema/envelope.xsd http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" xmlns:date="http://exslt.org/dates-and-times" xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP:Header><eb:MessageHeader SOAP:mustUnderstand="1" eb:version="2.0"><eb:From><eb:PartyId eb:type="string"/></eb:From><eb:To><eb:PartyId eb:type="string"/></eb:To><eb:CPAId>Invoice</eb:CPAId><eb:ConversationId/><eb:Service>uri:Invoice</eb:Service><eb:Action/><eb:MessageData><eb:MessageId/><eb:Timestamp>2015-08-22T14:59:52Z</eb:Timestamp></eb:MessageData><eb:DuplicateElimination SOAP:mustUnderstand="1" eb:version="2.0"/></eb:MessageHeader><eb:AckRequested SOAP:mustUnderstand="1" eb:version="2.0" eb:signed="false"/></SOAP:Header><SOAP:Body><eb:Manifest eb:version="2.0"><eb:Reference xlink:type="simple" xlink:href="cid:ebms2-payload@127.0.0.1"/></eb:Manifest></SOAP:Body></SOAP:Envelope>
    --a87da0fa-8397-4e21-82ba-d0627a4295a6
    Content-ID: <ebms2-payload@127.0.0.1>
    Content-Transfer-Encoding: binary

    test
    --a87da0fa-8397-4e21-82ba-d0627a4295a6--
    * Connection #0 to host dp3-l3 left intact
    * Closing connection #0
    $

     

    Hermann.

    Updated on 2015-08-22T15:04:13Z at 2015-08-22T15:04:13Z by HermannSW
  • Daviiid
    Daviiid
    348 Posts

    Re: Adding Attachment to a SOAP response and converting it into MTOM

    ‏2015-10-16T09:48:50Z  
    • HermannSW
    • ‏2015-07-25T14:04:43Z

    Hi Daviid,

    I have an idea:
    http://www-01.ibm.com/support/knowledgecenter/SS9H2Y_7.0.0/com.ibm.dp.xi.doc/set-mime-header_element.html


    But I was not able to modify Content-Type header you are interested in with it:

    <pre class="javascript dw" data-editor-lang="js" data-pbcklang="javascript" dir="ltr">< HTTP/1.1 200 OK < X-Backside-Transport: FAIL FAIL < Connection: Keep-Alive < Transfer-Encoding: chunked < Content-Type: multipart/related; boundary="a5608e93-fde0-401f-976b-1d073ff15b61"; type="application/soap+xml" < --a5608e93-fde0-401f-976b-1d073ff15b61 Content-Type: application/soap+xml Content-Transfer-Encoding: binary --a5608e93-fde0-401f-976b-1d073ff15b61 Content-ID: <nonXML> Content-Transfer-Encoding: binary tet --a5608e93-fde0-401f-976b-1d073ff15b61-- * Connection #0 to host dp3-l3 left intact * Closing connection #0 $ </pre>

     

    Please open a question type PMR in order to get your question answered.


    Hermann.

    Hi

    Below the ibm PMR response

    The initial question was : how to add information in Content-Type Response with Hermann Xsl example when creation swa response.

     

    Hello David,
    Below is findings:
    There are two potential options here.

    One: this is an optional parameter and cannot be explicitly changed in DataPower currently. And you can submit an RFE to see this put into a future release (relates to option two).

    Two: This is available via and extension variable.

    <value name="var://local/set-start- parameter" write-only="true"
    internal="true"/>

    This, unfortunately is not a documented variable, so we can technically remove
    this (unlikely) without notification to you.