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 » Regarding JCN

Post new topic  Reply to topic
 Regarding JCN « View previous topic :: View next topic » 
Author Message
anilmekala
PostPosted: Mon Jun 01, 2015 10:04 pm    Post subject: Regarding JCN Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi,

I hope everybody doing good.

I have small scenario by using JCN.

my flow looks as below

MQINPUT -->JCN --> MQOUTPUT

I had given message message domain As XMLNSC for MQINPUT node.

When i debug my flow am able to Message tree properly

When trying access the payload element am getting Runtime exception.

Please let me know do i need to do any configurations in IIB JCN.

Please find my JCN code as below :



Code:
MbOutputTerminal out = getOutputTerminal("out");
      MbMessage message = assembly.getMessage();
      MbMessage newMsg= new MbMessage(message);
      

      try {
         // optionally copy message headers
         copyMessageHeaders(message, newMsg);
         // ----------------------------------------------------------
         // Add user code below
         
                  
         MbElement root = newMsg.getRootElement();
         MbElement body = root.getLastChild();
         
         String bodymessage = body.getValue().toString();
         
         MbMessageAssembly outAssembly = new MbMessageAssembly(assembly,
               newMsg);
         out.propagate(outAssembly);
         // End of user code
         // ----------------------------------------------------------
      } catch (MbException e) {
         // Re-throw to allow Broker handling of MbException
         throw e;
      } catch (RuntimeException e) {
         // Re-throw to allow Broker handling of RuntimeException
          e.printStackTrace();
      } catch (Exception e) {
         // Consider replacing Exception with type(s) thrown by user code
         // Example handling ensures all exceptions are re-thrown to be handled in the flow
         throw new MbUserException(this, "evaluate()", "", "", e.toString(),
               null);
      }
      // The following should only be changed
      // if not propagating message to the 'out' terminal
      
   }


Thanks in Advance for your help.


Regards,


Anil.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jun 02, 2015 2:20 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well you have a new message, so you copy the headers...
What you access as Body is in fact the last child of OutputRoot.... which at that point points to the last header.
You need to declare a parser and then copy a body... Look at the samples with JCN. This will help you build your code...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
inMo
PostPosted: Tue Jun 02, 2015 6:07 am    Post subject: Reply with quote

Master

Joined: 27 Jun 2009
Posts: 216
Location: NY

You don't mention the exception anywhere. Are you able to observe & communicate the error condition?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 02, 2015 6:15 am    Post subject: Re: Regarding JCN Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

anilmekala wrote:
Code:
         String bodymessage = body.getValue().toString();


That's entirely nonsense and doesn't do anything useful.
Back to top
View user's profile Send private message
iibmate
PostPosted: Tue Jun 02, 2015 7:51 pm    Post subject: Re: Regarding JCN Reply with quote

Apprentice

Joined: 17 Mar 2015
Posts: 38
Location: Perth, WA

mqjeff wrote:
anilmekala wrote:
Code:
         String bodymessage = body.getValue().toString();


That's entirely nonsense and doesn't do anything useful.


Correct.

Should use

bodymessage = body.getlastchild().getValue().toString(); if xml message is having only one root tag with value.

Posting queries without correct info does nt make sence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 03, 2015 5:10 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The XML document will have been turned into a complete message tree.

You do not need to parse it again.

You just have to understand how to write Broker code in a JCN.
Back to top
View user's profile Send private message
anilmekala
PostPosted: Thu Jun 04, 2015 12:22 am    Post subject: Reply with quote

Acolyte

Joined: 19 Oct 2012
Posts: 63

Hi,

Thank you so much for your response.

my issue got resolved . I forgot add message domain to outputroot element.

Regards,

Anil.
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 » Regarding JCN
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.