Author |
Message
|
shrusonu |
Posted: Tue Apr 15, 2014 3:23 am Post subject: Calling external java class in XSLT Transform node |
|
|
 Novice
Joined: 20 Dec 2013 Posts: 16
|
Hello All,
I am using XSLT transform node for transforming messages. From .xsl i have to call a external java class - i am unable to succeed.
I am using WMB 8.0.0.2 on windows
The exception details - Transcript
<ExceptionDetails>
<ExceptionType>RecoverableException</ExceptionType>
<NodeLabel>XMLT_Sample_Flow.XMLTransformation</NodeLabel>
<BIPErrorNo>4447</BIPErrorNo>
<DiagnosticErrorDetails>Caught exception and rethrowing, Error during transformation</DiagnosticErrorDetails>
<CauseOfError> XMLTransformation Transformation failure when processing Stylesheet Siebel.xsl..
javax.xml.transform.TransformerException: The XSL processor reported a possibly fatal error...
Message: java.lang.NoSuchMethodException: For extension function,
could not find method org.apache.xml.utils.NodeVector.convertSASToSiebelDateTime([ExpressionContext,] )....
at com.ibm.xsl.exmlt.ParseFacilitator.fatalError(ParseFacilitator.java:479)...
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1520)...
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:800)...
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1384)...
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1362)...
at com.ibm.xsl.exmlt.ParseFacilitator.parseXmlStylesheet(ParseFacilitator.java:274)...
at com.ibm.xsl.exmlt.ParseFacilitator.parse(ParseFacilitator.java:216)...
at com.ibm.xsl.exmlt.EnhancedXMLTransform.transformWithStylesheet(EnhancedXMLTransform.java:672)...
at com.ibm.xsl.exmlt.EnhancedXMLTransform.transformDocument(EnhancedXMLTransform.java:627)...
at com.ibm.xsl.mqsi.XMLTransformData.transformData(XMLTransformData.java:555)...
at com.ibm.xsl.mqsi.XMLTransformNode.evaluate(XMLTransformNode.java:965)...
at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1480)..</CauseOfError>
<InputMessage>
I have gone through some of the support docs - i came across below
" The Javaâ„¢ JRE also includes Xalan-Java and Xerces JAR files, but you might experience unpredictable results when these Java XML processing methods are invoked by using an external Java method from a style sheet. Therefore, the calling of Java methods from a style sheet that directly or indirectly reference Java JRE XML processing methods is unsupported."
Does that mean it is not possible to call any java class within the xsl file?
Regards
Sunil |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Apr 15, 2014 3:50 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
AFAIK, it can be done. I know of a project that is using it but I don't know how it is done. It is also pretty slow by all accounts.
XSLT's are IMHO the place of last resort but I know some others will disagree with me.
As they say when asking directions for a place out in the county, 'I wouldn't start from here'. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
shrusonu |
Posted: Tue Apr 15, 2014 4:47 am Post subject: |
|
|
 Novice
Joined: 20 Dec 2013 Posts: 16
|
Thanks for reply.
Can you please let me know, how it can be achieved.
I have tried using below -
Code: |
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:xalan="http://xml.apache.org/xslt"
xmlns:dateutilities="xalan://us.co.car.adap.sas.SASUtilities"
exclude-result-prefixes="dateutilities">
|
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 15, 2014 5:53 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
shrusonu wrote: |
Can you please let me know, how it can be achieved |
smdavies99 wrote: |
I don't know how it is done. |
smdavies99 wrote: |
It is also pretty slow by all accounts. |
XMLNSC parser and mapping node are going to be faster than XSLT. |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Apr 15, 2014 6:00 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
mqjeff wrote: |
smdavies99 wrote: |
It is also pretty slow by all accounts. |
XMLNSC parser and mapping node are going to be faster than XSLT. |
you can't access trees (Environment, LocalEnvironment) from within XSLT
The XSLT Transformation node "invokes" an external engine (xalan or xerces or something) and this returns with the result.
This may have changed, since you can "invoke Java" from it.
With "XMLNSC" mqjeff basically means ESQL, which he is using most of the time !
Use ESQL or explain why you don't _________________ Just use REFERENCEs |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 15, 2014 6:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqsiuser wrote: |
Use ESQL or explain why you don't |
Where "because I can manage with the mapping node" is an acceptable explaination.
More seriously, why XSLT? As my worthy associate pointed out, it really is the last choice given the richness of the other options available.
Again, an acceptable explaination is "because we've been using this sheet for years", which will be tempered with "so why still use it when you need to change it?" _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 15, 2014 7:51 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
mqsiuser wrote: |
With "XMLNSC" mqjeff basically means ESQL, which he is using most of the time ! |
No.
Where I say "XMLNSC", I mean exactly the parser. And I don't mean the XML parser and I don't mean the XMLNS parser. I mean exactly and specifically the XMLNSC parser.
Where I say "mapping node", I mean exactly the Graphical Data Mapper in v8 or later. I do not mean ESQL, I do not mean Java, I do not mean PHP or .NET.
I am assuming XSLT is being used 'because people know it', or 'because we have existing transformations written in it'. The GDM is a reasonable replacement for those, that will outperform XSLT in IIB. And it's easier to call external java functions. |
|
Back to top |
|
 |
|