ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JCN MbElement to Element

Post new topic  Reply to topic
 JCN MbElement to Element « View previous topic :: View next topic » 
Author Message
shrusonu
PostPosted: Thu Nov 16, 2017 1:50 am    Post subject: JCN MbElement to Element Reply with quote

Novice

Joined: 20 Dec 2013
Posts: 16

Hello All,

I am working on IIB v10.0.0.9 on windows

I have a problem while calling Java methods from ESQL or JCN java.

I have an existing Java project which contains many classes & methods. I know that we can make a call to java methods from ESQL.
Problem is Existing Java methods have arguments defined of type org.w3c.dom.Element.

How i can achieve if i am using JCN to make calls to these methods? Casting from MbElement to org.w3c.dom.Element is not working throws CAST Exception.

Any links to materials would be helpful.
Your help is very much appreciated.

Thanks
Back to top
View user's profile Send private message
timber
PostPosted: Thu Nov 16, 2017 9:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Quote:
I have an existing Java project which contains many classes & methods.
What do these classes/methods do? If they are manipulating a DOM tree then there may be a better solution.
Back to top
View user's profile Send private message
shrusonu
PostPosted: Thu Nov 16, 2017 11:01 pm    Post subject: Reply with quote

Novice

Joined: 20 Dec 2013
Posts: 16

Quote:
What do these classes/methods do? If they are manipulating a DOM tree then there may be a better solution.


Yes, the methods do manipulations with DOM Document, NodeList & Element.

I believe the methods would produce a resultant new XML depending upon the input arguments.
Back to top
View user's profile Send private message
timber
PostPosted: Fri Nov 17, 2017 4:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

IIB provides 4 different ways of manipulating the content of XML documents. Why do you want to use these Java classes to do it? Is the transformation logic particularly complex?

If you are determined to pursue this design, you might get more success by using the JAXB option in the JavaCompute node. That presents a message tree as a DOM in the JavaCompute node. But I have no idea whether the JCN DOM objects will be compatible with your legacy Java code.
Back to top
View user's profile Send private message
shrusonu
PostPosted: Fri Apr 03, 2020 5:20 am    Post subject: Reply with quote

Novice

Joined: 20 Dec 2013
Posts: 16

Managed to get through it.
here, it might help someone in need -

Code:

org.w3c.dom.Document doc = com.ibm.broker.plugin.MbMessageAssembly contact admin.getMessage().getDOMDocument();
org.w3c.dom.NodeList nodeList = (NodeList) javax.xml.xpath.evaluate("Give your xPath", doc, XPathConstants.NODESET);
org.w3c.dom.Element element = (Element) nodeList .item(0);


Dom element is now passed to legacy code further
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » JCN MbElement to Element
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.