| Author | 
		  Message
		 | 
		
		  | elaforc | 
		  
		    
			  
				 Posted: Fri Oct 23, 2009 7:54 am    Post subject: XPath set-value numeric | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 29 Sep 2009 Posts: 10
  
  | 
		  
		    
			  
				All,
 
 
I am currently using WMB 6.0.2.  I am trying to write a simple message flow using a java compute node that will set the persistence to 1 in the MQMD Header using XPath.  Currently my code looks as follows:
 
 
   
	| Code: | 
   
  
	
 
public void addPersistance(MbMessage msg) throws MbException
 
{
 
   MbElement root = msg.getRootElement();   
 
   root.evaluateXPath("?MQMD/?Persistence[set-value(number(1))]");
 
}
 
 | 
   
 
 
 
I pass in to addPersistance a copy of the message stored in the incoming message assembly parameter from the evaluate function.
 
 
I am currently seeing the following error in /var/log/syslog.user (I am on AIX 6):
 
 
Oct 23 10:46:38 entmqsx2 user:warn|warning WebSphere Broker v6003[798952]: (ENTCLTX2.ROF)[5912]BIP5912W: Error in parser 'MQMD' whilst writing the field named 'Persistence' to the bitstream. : ENTCLTX2.b467a577-2401-0000-0080-d41ef0a67873: /build/S600_P/src/DataFlowEngine/ImbMqmdParser.cpp: 1081: ImbMqmdParser::writeMqmd: ComIbmJniNode: ROF#FCMComposite_1_2
 
 
Oct 23 10:46:38 entmqsx2 user:err|error WebSphere Broker v6003[798952]: (ENTCLTX2.ROF)[5912]BIP2328E: A value of SQL datatype 'CHARACTER' encountered when datatype 'INTEGER' expected. : ENTCLTX2.b467a577-2401-0000-0080-d41ef0a67873: /build/S600_P/src/CommonServices/ImbValue.cpp: 965: ImbValue::typeError: :
 
 
 
I see that it is a type issue, but I am not sure of the proper way to tell xpath to use a numeric value.  I tried just passing in set-value('1'), or set-value(1), or set-value(true) just for kicks, but I still see the same error.  
 
 
Any ideas on the proper way to do this?  Thanks for your help. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Fri Oct 23, 2009 9:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				| Try using an xs: cast.  Something like root.evaluateXPath("?MQMD/?Persistence[set-value(xs:integer(1))]"); | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | elaforc | 
		  
		    
			  
				 Posted: Fri Oct 23, 2009 10:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 29 Sep 2009 Posts: 10
  
  | 
		  
		    
			  
				Thanks for the response.
 
 
Doesn't look like it liked that either.
 
 
Oct 23 13:50:06 entmqsx2 user:err|error WebSphere Broker v6003[798952]: (ENTCLTX2.ROF)[5912]BIP4382E: XPath parse error at column '40' in expression '?MQMD/?Persistence[set-value(xs:integer(1))]'. : ENTCLTX2.b467a577-2401-0000-0080-d41ef0a67873: /build/S600_P/src/DataFlowEngine/PluginInterface/ImbXPathParser.y: 494: parse_expression: :
 
 
I don't know if casting helps though, because looking at the "set-value" function http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac30390_.htm
 
it says:
 
 
   
	| Quote: | 
   
  
	
 
This function sets the string value of the context node to the value specified in the argument. object can be any valid expression, and is converted to a string as if a call to the string function is used.
 
 | 
   
 
 
So it seems to me that no matter what you pass in, its going to cast it to a string.  
 
 
Maybe XPATH isn't the way to do this?
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | smdavies99 | 
		  
		    
			  
				 Posted: Fri Oct 23, 2009 10:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land. 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	
 
Maybe XPATH isn't the way to do this?
 
 | 
   
 
 
Yes, ESQL makes this little job very easy   _________________ 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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | elaforc | 
		  
		    
			  
				 Posted: Fri Oct 23, 2009 1:57 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 29 Sep 2009 Posts: 10
  
  | 
		  
		    
			  
				I determined the solution.
 
 
The proper way is as follows:
 
 
   
	| Code: | 
   
  
	
 
 
public void addPersistance(MbMessage msg) throws MbException
 
{                                                              
 
     MbElement root = msg.getRootElement();                            
 
     MbElement psist = (MbElement)((List)root.evaluateXPath("?MQMD/?Persistence")).get(0);
 
     psist.setValue(newInteger(1));                                                                 
 
}
 
 
 | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mqjeff | 
		  
		    
			  
				 Posted: Fri Oct 23, 2009 2:20 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 25 Jun 2008 Posts: 17447
  
  | 
		  
		    
			  
				
   
	| elaforc wrote: | 
   
  
	| I determined the solution. | 
   
 
 
 
You're welcome. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | elaforc | 
		  
		    
			  
				 Posted: Mon Oct 26, 2009 5:11 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 29 Sep 2009 Posts: 10
  
  | 
		  
		    
			  
				
   
	| mqjeff wrote: | 
   
  
	
   
	| elaforc wrote: | 
   
  
	| I determined the solution. | 
   
 
 
 
You're welcome. | 
   
 
 
 
Correction, by "I determined the solution" it should read "mqjeff determined the solution and pm'ed me the answer".  
 
 
Thanks for your help | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |