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 » Extracting CDATA in a Java Compute Node

Post new topic  Reply to topic
 Extracting CDATA in a Java Compute Node « View previous topic :: View next topic » 
Author Message
deepeshk79
PostPosted: Wed Sep 22, 2010 1:55 pm    Post subject: Extracting CDATA in a Java Compute Node Reply with quote

Apprentice

Joined: 25 Mar 2007
Posts: 45
Location: Los Angeles

Hi All,

I have an input message as below

Code:

Sample Response Message:
<?xml version="1.0" encoding="UTF-8"?>
<?ABHeader version="1.0"?>
<?ABEnvelope>
            <Application_ID>rrr</Application_ID>
            <Password/>
            <Message_ID>FtestE</Message_ID>
            <Message_Format>XML</Message_Format>
            <Transaction_Type>moneytransfer</Transaction_Type>
            <Payload><![CDATA[OG4341432 54543 testing tsting testing 203203700.00C1     2.500000000     0.000000000     0.000000000            0.00D      0.000000000     0.000000000     0.000000000     0.000000000N     0.000000000N     0.000000000N]]></Payload>
</ABEnvelope>


In my java compute node, Im trying to extract the payload which is a CDATA . the code im using is as below

Code:

String payload =  outMessageBody.getFirstElementByPath("/ABEnvelope/Payload" );



But this always results in a null pointer exception. Is there a different way to extract CDATA section from an XML in a Java Compute node ?

Thanks,
Deepesh
Back to top
View user's profile Send private message AIM Address
mqjeff
PostPosted: Wed Sep 22, 2010 6:04 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Are you positive that the contents of the CDATASection are actually the value of the element containing the CDATASection?

Have you taken a trace of the message flow structure to confirm that?
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Thu Sep 23, 2010 5:36 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

You need to check to see what type of object the getFirstElementByPath() call returns to you.

Hint: It is not a String.

Your XML also looks invalid but they may just be an artifact of your copying it to here.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Sep 23, 2010 6:29 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

In case you didn't get mqjeff's suggestion...put in a Trace node, and look carefully at the output.
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 » Extracting CDATA in a Java Compute Node
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.