Topic
  • 7 replies
  • Latest Post - ‏2012-12-24T01:37:23Z by HermannSW
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic Can DP use something like a Java class for transforms?

‏2012-12-21T17:29:03Z |
We are doing binary transforms, and I'm officially declaring WTX the transformation enemy of the universe. What we can do in Java in about 10 minutes is taking days to figure out in WTX, and we still haven't succeeded.

The truth is, we aren't really doing a "binary" transform. We are handling HL7 files, which are ASCII text.

Since DP is running Java internally, is it possible to tell DP to use some kind of Java class to handle binary transforms?

I mean, it would make DP infinitely more powerful, and if they enabled such a thing via a strict interface running inside a simple sandbox with a strict security manager, wouldn't everyone's life be so much better?
Updated on 2012-12-24T01:37:23Z at 2012-12-24T01:37:23Z by HermannSW
  • HermannSW
    HermannSW
    4651 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-21T19:52:37Z  
    > Since DP is running Java internally, is it possible to tell DP to use some kind of Java class to handle binary transforms?
    >
    That is definitely not true.

    > The truth is, we aren't really doing a "binary" transform. We are handling HL7 files, which are ASCII text.
    >
    You can use below stylesheet in a "Transform Binary Action" to process any Non-XML input "UTF-8 string" (includes ASCII):
    
    $ echo -n 
    "test123" | coproc2 to-utf8.xsl -  http:
    //dp5-l3:2224 -s ; echo <read>test123</read> $ $ cat to-utf8.xsl <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" > <dp:input-mapping  href=
    "store:///pkcs7-convert-input.ffd" type=
    "ffd"/>   <xsl:output omit-xml-declaration=
    "yes" /> <xsl:template match=
    "/"> <xsl:variable name=
    "input64" select=
    "dp:binary-encode(/object/message/node())" /> <!-- 
    
    this does UTF-8 validation and decoding --> <xsl:variable name=
    "str" select=
    "dp:decode($input64, 'base-64')"/>   <read> <xsl:value-of select=
    "$str"/> </read> </xsl:template> </xsl:stylesheet> $
    


     
    Hermann<myXsltBlog/> <myXsltTweets/>
  • kenhygh
    kenhygh
    1522 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-21T19:54:00Z  
    Uh, DataPower is definitely NOT running Java internally. So no way to execute a Java class.

    The learning curve on WTX is pretty steep, though.

    Ken
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-21T19:57:34Z  
    • HermannSW
    • ‏2012-12-21T19:52:37Z
    > Since DP is running Java internally, is it possible to tell DP to use some kind of Java class to handle binary transforms?
    >
    That is definitely not true.

    > The truth is, we aren't really doing a "binary" transform. We are handling HL7 files, which are ASCII text.
    >
    You can use below stylesheet in a "Transform Binary Action" to process any Non-XML input "UTF-8 string" (includes ASCII):
    <pre class="jive-pre"> $ echo -n "test123" | coproc2 to-utf8.xsl - http: //dp5-l3:2224 -s ; echo <read>test123</read> $ $ cat to-utf8.xsl <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" > <dp:input-mapping href= "store:///pkcs7-convert-input.ffd" type= "ffd"/> <xsl:output omit-xml-declaration= "yes" /> <xsl:template match= "/"> <xsl:variable name= "input64" select= "dp:binary-encode(/object/message/node())" /> <!-- this does UTF-8 validation and decoding --> <xsl:variable name= "str" select= "dp:decode($input64, 'base-64')"/> <read> <xsl:value-of select= "$str"/> </read> </xsl:template> </xsl:stylesheet> $ </pre>

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    So, when my device has "Java API for XML processing support", does this mean it isn't using Java?
  • kenhygh
    kenhygh
    1522 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-21T22:05:09Z  
    So, when my device has "Java API for XML processing support", does this mean it isn't using Java?
    yup. It may be using the wire format for that API, but there really really is no Java.

    Ken
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-21T23:03:48Z  
    • kenhygh
    • ‏2012-12-21T22:05:09Z
    yup. It may be using the wire format for that API, but there really really is no Java.

    Ken
    So... how hard would it be? In the same way they did the CLI for DataPower, why can't IBM create a very restricted JVM with a very strong Security Manager and a very small subset of RT Java and a set of very strict interfaces for transforms? I spent 3 days trying to figure out a single very simple example in WTX what I and every other Java programmer could pull off in about 5 minutes with Java (and that includes loading Eclipse).

    When we start talking about TCO...it takes only a few moments to figure out the cost of WTX, WTX Training, a WTX resource, etc., compared to a Java one. I think Intel's SOA Gateway supports Java, and it seems like such a natural fit for the environment.

    On the downside, though, I assume if they started supporting Java, they'd be flooded with requests for C/C++/PERL, etc.... but.. I'd take a scripting language over WTX any day!

    Anyway.... guess I can dream...
  • HermannSW
    HermannSW
    4651 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-22T14:59:23Z  
    • kenhygh
    • ‏2012-12-21T19:54:00Z
    Uh, DataPower is definitely NOT running Java internally. So no way to execute a Java class.

    The learning curve on WTX is pretty steep, though.

    Ken
    Hi Joseph,

    perhaps you should really try the stylesheet I posted above.
    Or let me help you with the first step.

    Please attach here a small sample HL7 message, and show what output you want to generate from it.
    It may be very simple to do based on above stylesheet.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
  • HermannSW
    HermannSW
    4651 Posts

    Re: Can DP use something like a Java class for transforms?

    ‏2012-12-24T01:37:23Z  
    • HermannSW
    • ‏2012-12-22T14:59:23Z
    Hi Joseph,

    perhaps you should really try the stylesheet I posted above.
    Or let me help you with the first step.

    Please attach here a small sample HL7 message, and show what output you want to generate from it.
    It may be very simple to do based on above stylesheet.

     
    Hermann<myXsltBlog/> <myXsltTweets/>
    Just posted a simple Non-XML stylesheet to fix MIME boundary problems here:
    https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14922978#14922978

    You can take this as a sample of how easy Non-XML transformations can be done in a stylesheet.

    And there are two WSTE webcasts on "Non-XML data processing in DataPower stylesheets".
    You can find all sample stylesheets and data attached, and if you "hear into" the attached recording
    the attached presentation should give you a good idea on basics and advanced:
    http://www-01.ibm.com/support/docview.wss?uid=swg27022977
    http://www-01.ibm.com/support/docview.wss?uid=swg27022979

     
    Hermann<myXsltBlog/> <myXsltTweets/>