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

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
    4657 Posts

    Re: Create MTOM message from SOAP

    ‏2012-11-06T18:15:56Z  
    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

    Re: Create MTOM message from SOAP

    ‏2012-11-06T20:11:24Z  
    • HermannSW
    • ‏2012-11-06T18:15:56Z
    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/>
    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
    4657 Posts

    Re: Create MTOM message from SOAP

    ‏2012-11-07T10:14:52Z  
    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.
    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

    Re: Create MTOM message from SOAP

    ‏2012-11-07T19:30:52Z  
    • HermannSW
    • ‏2012-11-07T10:14:52Z
    Hi Burt,

    sample solution for you (also attached):
    <pre class="jive-pre"> $ 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> $ </pre>

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    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!
  • HermannSW
    HermannSW
    4657 Posts

    Re: Create MTOM message from SOAP

    ‏2012-11-07T19:50:52Z  
    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!
    > ... Do you have the latest version of coproc that I can use to test this with. Thanks!
    >
    There was only one coproc2 service export, it has not changed, attached here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14590913

    The "bash" client has not changed, too:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14590916

    If you want to use the Java client, then latest version (v1.2) is here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14622179

    Mr. Craig Oddy enhanced that (v1.3) for uploading multiple files into "temporary:" folder:
    https://www.ibm.com/developerworks/forums/thread.jspa?threadID=455749

    In that thread also the 5.0.0.x firmware "Interoperability Test Service" is discussed.

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

    Re: Create MTOM message from SOAP

    ‏2012-11-09T16:11:12Z  
    • HermannSW
    • ‏2012-11-07T19:50:52Z
    > ... Do you have the latest version of coproc that I can use to test this with. Thanks!
    >
    There was only one coproc2 service export, it has not changed, attached here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14590913

    The "bash" client has not changed, too:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14590916

    If you want to use the Java client, then latest version (v1.2) is here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14622179

    Mr. Craig Oddy enhanced that (v1.3) for uploading multiple files into "temporary:" folder:
    https://www.ibm.com/developerworks/forums/thread.jspa?threadID=455749

    In that thread also the 5.0.0.x firmware "Interoperability Test Service" is discussed.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    In running ur example against the coproc2 service I get the following message:

    10:56:12 mpgw error 46771074 error 0x00030001 mpgw (coproc2): Parse error
    10:56:12 multistep error 46771074 request 0x80c00008 mpgw (coproc2): rule (coproc2_rule_1): implied action Parse input as XML failed: illegal character 'b' at offset 6 of http://dp1:2223/
    10:56:12 xmlparse error 46771074 request 0x80e003aa mpgw (coproc2): illegal character 'b' at offset 6 of http://dp1:2223/

    also, I have a SOAP message I would like to wrap and in trying to echo a file piped to the bash coproc script. It seems though that I can't pipe a file to this script but can only use simple xml? Is there a way of extending this to accept a file as well.
  • triniman10
    triniman10
    29 Posts

    Re: Create MTOM message from SOAP

    ‏2012-11-09T22:09:43Z  
    • HermannSW
    • ‏2012-11-07T19:50:52Z
    > ... Do you have the latest version of coproc that I can use to test this with. Thanks!
    >
    There was only one coproc2 service export, it has not changed, attached here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14590913

    The "bash" client has not changed, too:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14590916

    If you want to use the Java client, then latest version (v1.2) is here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14590913#14622179

    Mr. Craig Oddy enhanced that (v1.3) for uploading multiple files into "temporary:" folder:
    https://www.ibm.com/developerworks/forums/thread.jspa?threadID=455749

    In that thread also the 5.0.0.x firmware "Interoperability Test Service" is discussed.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    I talked to one of my System Admims much more familiar with curl and when I cat-ed my file to the coproc it produced the message that I needed. Thanks much for that sampe xsl as that worked well once I understand how to use it.
  • lenisha
    lenisha
    23 Posts

    Re: Create MTOM message from SOAP

    ‏2013-08-22T03:04:42Z  
    • HermannSW
    • ‏2012-11-07T10:14:52Z
    Hi Burt,

    sample solution for you (also attached):
    <pre class="jive-pre"> $ 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> $ </pre>

     
    Hermann<myXsltBlog/> <myXsltTweets/>

    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
    4657 Posts

    Re: Create MTOM message from SOAP

    ‏2013-08-22T19:56:22Z  
    • lenisha
    • ‏2013-08-22T03:04:42Z

    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

    Hi,

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

    Hermann.

  • lenisha
    lenisha
    23 Posts

    Re: Create MTOM message from SOAP

    ‏2013-08-26T18:40:31Z  
    • HermannSW
    • ‏2013-08-22T19:56:22Z

    Hi,

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

    Hermann.

    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
    4657 Posts

    Re: Create MTOM message from SOAP

    ‏2013-08-27T09:42:21Z  
    • lenisha
    • ‏2013-08-26T18:40:31Z

    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?

    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
  • lenisha
    lenisha
    23 Posts

    Re: Create MTOM message from SOAP

    ‏2013-09-11T03:44:02Z  
    • HermannSW
    • ‏2013-08-27T09:42:21Z

    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/>

    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