Topic
12 replies Latest Post - ‏2013-09-11T03:44:02Z by lenisha
triniman10
triniman10
29 Posts
ACCEPTED ANSWER

Pinned topic Create MTOM message from SOAP

‏2012-11-05T20:53:32Z |
In troubleshooting a customers issue I have a need to create an MTOM message from a simple SOAP message in essence creating a single part MIME message. Does anyone have a configuration that does something similar to this. I seem to remember coming across a post a few months back regarding this very thing and I can't seem to find it.

Any help would be appreciated.
Updated on 2012-11-09T22:09:43Z at 2012-11-09T22:09:43Z by triniman10
  • HermannSW
    HermannSW
    3145 Posts
    ACCEPTED ANSWER

    Re: Create MTOM message from SOAP

    ‏2012-11-06T18:15:56Z  in response to triniman10
    If you need to do that, you can -- but you have to do it "by hand".

    See this posting for an example of how to create "your own" MIME output (<xsl:value-of disable-output-escaping="true" select="...."/> is the key):
    https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/entry/smtp2

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    • triniman10
      triniman10
      29 Posts
      ACCEPTED ANSWER

      Re: Create MTOM message from SOAP

      ‏2012-11-06T20:11:24Z  in response to HermannSW
      And this was the post I was looking for so thanks for the link. I think the last time I was working with this a few months back that requirement went away and I never did fully implement it.
      • HermannSW
        HermannSW
        3145 Posts
        ACCEPTED ANSWER

        Re: Create MTOM message from SOAP

        ‏2012-11-07T10:14:52Z  in response to triniman10
        Hi Burt,

        sample solution for you (also attached):
        
        $ echo 
        "<I am="busy
        ">☻</I>" | coproc2 single-part-mime.xsl - http:
        //dp3-l3:2223 MIME-Version: 1.0 Content-type: multipart/alternative; boundary=
        "9745908a-547e-4a85-9018-495ef1462d1c"   --9745908a-547e-4a85-9018-495ef1462d1c Content-type: application/xml   <I am=
        "busy">☻</I> --9745908a-547e-4a85-9018-495ef1462d1c-- epilogue $ $ cat single-part-mime.xsl <!-- Wrap input XML into a single part MIME message.   
        "mixed/alternative" seems to be the best Multipart subtype (see http:
        //en.wikipedia.org/wiki/MIME#Mixed). --> <xsl:stylesheet version=
        "1.0" xmlns:xsl =
        "http://www.w3.org/1999/XSL/Transform" xmlns:dp  =
        "http://www.datapower.com/extensions" extension-element-prefixes=
        "dp" > <xsl:output omit-xml-declaration=
        "yes" />   <!-- some constants --> <xsl:variable name=
        "CRLF"  select=
        "'&#13;&#10;'"/> <xsl:variable name=
        "DDASH" select=
        "'--'"/> <xsl:variable name=
        "QUOT"  select=
        "'&quot;'"/>     <xsl:template match=
        "/">   <!-- as the name says, get us a unique MIME boundary --> <xsl:variable name=
        "boundary" select=
        "dp:generate-uuid()"/>     <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat('MIME-Version: 1.0',$CRLF)"/> <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat('Content-type: multipart/alternative; boundary=',$QUOT)"/> <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat($boundary,$QUOT)"/>   <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat($CRLF,$CRLF,$DDASH,$boundary,$CRLF)"/>   <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat('Content-type: application/xml',$CRLF,$CRLF)"/>   <xsl:copy-of select=
        "."/>   <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat($CRLF,$DDASH,$boundary,$DDASH,$CRLF)"/> <xsl:value-of disable-output-escaping=
        "yes" select=
        "concat('epilogue',$CRLF)"/>   </xsl:template> </xsl:stylesheet> $
        


         
        Hermann<myXsltBlog/> <myXsltTweets/>
        • triniman10
          triniman10
          29 Posts
          ACCEPTED ANSWER

          Re: Create MTOM message from SOAP

          ‏2012-11-07T19:30:52Z  in response to HermannSW
          Thanks much as this really helps. I haven't changed jobs and I had coproc downloaded and installed on my last machine but not on this one. I see multiple posts on coproc and one of the blog links I clicked on for the latest didn't work. Do you have the latest version of coproc that I can use to test this with. Thanks!
        • lenisha
          lenisha
          20 Posts
          ACCEPTED ANSWER

          Re: Create MTOM message from SOAP

          ‏2013-08-22T03:04:42Z  in response to HermannSW

          Is there possibility to use this single part mime xsl as part of WSP?

          tried it as last action in the flo did not work

          • HermannSW
            HermannSW
            3145 Posts
            ACCEPTED ANSWER

            Re: Create MTOM message from SOAP

            ‏2013-08-22T19:56:22Z  in response to lenisha

            Hi,

            if your last transform action directly outputs to OUTPUT context without a Result action it should work.

            Hermann.

            • lenisha
              lenisha
              20 Posts
              ACCEPTED ANSWER

              Re: Create MTOM message from SOAP

              ‏2013-08-26T18:40:31Z  in response to HermannSW

              Nope did not work still does not pick up this non-XML Mime boundaries.....

              May be we need MPGW or XMLFW to make it work?

              • HermannSW
                HermannSW
                3145 Posts
                ACCEPTED ANSWER

                Re: Create MTOM message from SOAP

                ‏2013-08-27T09:42:21Z  in response to lenisha

                I do not have any problems with a WSP and single-mime-part.xsl.

                Please find in attached export WSP "single" listening on port 8123 and passthru loopback XML FW "lb8124" as backend.

                I took the WSDL and sample request from this posting:
                https://www.ibm.com/developerworks/community/forums/html/topic?id=53eb0302-6f0b-4b65-a641-ffaedf9e7cb0#d02d7808-b6a6-4939-8fe1-533ae39eba4f

                What you need to know is, that the WSDL defines <input> operation only and that makes it one-way.
                In one-way processing DataPower does NOT execute response rule (although defined), just does passthru.

                "backend" simulating "lb8124" just resturns what it received untouched.

                This "curl" execution shows that everything works as it should:

                $ curl --data-binary @getCertDetails.xml http://dp8-13:8123/certdetails
                MIME-Version: 1.0
                Content-type: multipart/alternative; boundary="9ad8b5c8-9268-4805-bd0d-c795036977a5"

                --9ad8b5c8-9268-4805-bd0d-c795036977a5
                Content-type: application/xml

                <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
                <SOAP:Body>
                <certname xmlns="urn:certdetails">tst1</certname>
                </SOAP:Body>
                </SOAP:Envelope>
                --9ad8b5c8-9268-4805-bd0d-c795036977a5--
                epilogue
                $


                Please try out with attached (3.8.1.21) export on your box.

                After that works, you need to find out what you do differently.

                 

                 

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

                Attachments

                Updated on 2013-08-27T09:53:43Z at 2013-08-27T09:53:43Z by HermannSW
                • This reply was deleted by HermannSW 2013-08-27T09:55:13Z. Reason for deletion: Attachment in previous posting.
                • lenisha
                  lenisha
                  20 Posts
                  ACCEPTED ANSWER

                  Re: Create MTOM message from SOAP

                  ‏2013-09-11T03:44:02Z  in response to HermannSW

                  Thank you Herman,  it really worked!

                  Just had to tweak a little bit content type and content id headers to match SOAP/XOP.

                  Attaching the slightly updated version.

                  Thank you for your great help.

                  Attachments