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 Problem

Post new topic  Reply to topic
 JCN Problem « View previous topic :: View next topic » 
Author Message
darring
PostPosted: Thu May 14, 2009 3:00 am    Post subject: JCN Problem Reply with quote

Apprentice

Joined: 14 Jun 2008
Posts: 36

Hi,
I am trying to learn JCN. I tried the following code:

public class CreateAllStudent_JavaCompute extends MbJavaComputeNode {
public void evaluate(MbMessageAssembly contact admin) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage inMessage = contact admin.getMessage();
MbElement inputRoot = inMessage.getRootElement();
MbElement inStudents = inputRoot.getLastChild();
MbMessage outMessage = new MbMessage();
MbElement InputRoot = contact admin.getMessage().getRootElement();
System.out.println("InputRoot :" + InputRoot.getName());
MbElement InputProperties =InputRoot.getFirstChild();
System.out.println("Input Properties: " + InputProperties.getName());
MbElement InputMQMD = InputProperties.getNextSibling();
System.out.println("Input MQMD: " + InputMQMD.getName());
MbElement InputBody = InputRoot.getLastChild();
System.out.println("InputBody :" + InputBody.getName());
MbElement Students = InputBody.getFirstChild();
System.out.println("Students :" + Students.getName());
MbElement StudentFirst = Students.getFirstChild();
if (StudentFirst == null)
System.out.println("Student First:" + "NULL");
else
System.out.println("Student First:" + StudentFirst.getName());
MbElement StudentLast = Students.getLastChild();
if (StudentLast == null)
System.out.println("Student Last:" + "NULL");
else
System.out.println("Student Last:" + StudentLast.getName());

System.out.println("Null Implemented");

try {
copyMessageHeaders(inMessage, outMessage);
} finally {

outMessage.clearMessage();
}
}


Here is the input message:
<Students>
<Student>
<FName>FName1</FName>
<Address>
<Street>Street1</Street>
</Address>
</Student>
<Student>
<FName>FName2</FName>
<Address>
<Street>Street2</Street>
</Address>
</Student>
</Students>


It's producing the output to stdout file as :
InputRoot :Root
Input Properties: Properties
Input MQMD: MQMD
InputBody :XML
Students :Students
Student First:
Student Last:
Null Implemented

The problem is it doesn't give me the name of the first child and las.t child of element Students. Am I doing something wrong here?????
MB 6.0.0.8, MQ 6.0 on Solaris

Thanks
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu May 14, 2009 3:21 am    Post subject: Re: JCN Problem Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

darring wrote:
Am I doing something wrong here?????


I dont think so.... the code looks fine to me.

If you trace the inputroot before the JCN does the tree look as expected?

I cant see any obvious reason why this would be, if you have just one student under students does it work different?
Back to top
View user's profile Send private message
darring
PostPosted: Thu May 14, 2009 4:10 am    Post subject: Thanks Reply with quote

Apprentice

Joined: 14 Jun 2008
Posts: 36

Hi,
This seems to be a parser problem. Earlier I had specified XML ans the parser to the MQInput node property, and the first child to the element Students was a blamk amd not the First Student element. Thanks to WMBDEV1, I got this after adding the trace to check the input tree. Now I have changed the parser to XMLNSC, not it recognises the Student as the first element of Students. Also the XMLNS behaves like XML parser. Not sure why... ????? I will have to take a look at the XMLNSC, XML and XMLNS documentation.... If any of you have some update on this please let us know.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu May 14, 2009 4:17 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Always use XMLNSC unless you know exactly why you shouldn't.

XMLNS acts like XML because its the same domain, except it supports namespaces where XML doesn't.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu May 14, 2009 4:18 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

Glad to hear you got it working.

XMNLSC is now the prefered parser anyway.
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 Problem
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.