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 » Java Compute Node accessing localenvironment values / XPath

Post new topic  Reply to topic
 Java Compute Node accessing localenvironment values / XPath « View previous topic :: View next topic » 
Author Message
jholand
PostPosted: Mon Jun 08, 2009 8:27 am    Post subject: Java Compute Node accessing localenvironment values / XPath Reply with quote

Newbie

Joined: 08 Jun 2009
Posts: 2

I am having troubles accessing the localenvironment values with a Java Compute node.
I have tried variations such as (example pruned to minimum):

public void evaluate(MbMessageAssembly contact admin) throws MbException {
try {
MbMessage localEnv = contact admin.getLocalEnvironment();
String fileName = "";
fileName = (String) localEnv.evaluateXPath("string(/localenvironment/file/@name");
fileName = (String) localEnv.evaluateXPath("string(/file/@name");
fileName = (String) localEnv.evaluateXPath("string(/file/name");
}
finally {}
}

but I never get anything more than NULL for fileName.

Has anyone ever accessed the vaulues in the localenvironment?
if so could you share a simply code example?

Many thanks.
John R. Holand
Back to top
View user's profile Send private message
rekarm01
PostPosted: Tue Jun 09, 2009 12:45 am    Post subject: Re: Java Compute Node accessing localenvironment values / XP Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

This looks like a question for the WMB forum.

jholand wrote:
I am having troubles accessing the LocalEnvironment values with a Java Compute node.
I have tried variations such as (example pruned to minimum):
Code:
public void evaluate(MbMessageAssembly contact admin) throws MbException {
  try {
    MbMessage localEnv = contact admin.getLocalEnvironment();
    String fileName = "";
    fileName = (String) localEnv.evaluateXPath("string(/localenvironment/file/@name");
    fileName = (String) localEnv.evaluateXPath("string(/file/@name");
    fileName = (String) localEnv.evaluateXPath("string(/file/name");
  }
  finally {}
}

but I never get anything more than NULL for fileName.

MbMessage.evaluateXPath() uses the last child of the message as the context node; that's typically more useful for the Root message (where the last child is the message body), rather than LocalEnvironment.

MbElement.evaluateXPath() may work better:
Code:
MbElement localEnv = contact admin.getLocalEnvironment().getRootElement();
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jun 09, 2009 1:16 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Moved to more relevant section
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jholand
PostPosted: Tue Jun 09, 2009 5:38 pm    Post subject: Reply with quote

Newbie

Joined: 08 Jun 2009
Posts: 2

I was able to finally figure this out, so I thought I would post the solution.
Here is the very brief (and now simple) code snippet.

MbElement localEnv = contact admin.getLocalEnvironment().getRootElement();
String directory = localEnv.getFirstChild().getFirstChild().getValueAsString();
String fileName = localEnv.getFirstChild().getFirstChild().getNextSibling().getValueAsString();
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 » Java Compute Node accessing localenvironment values / XPath
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.