axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Lowe" <rml...@rmlowe.com>
Subject Re: Retrieving a value from the Soap response ....
Date Sat, 26 Jul 2003 19:33:27 GMT
This is an eccentricity of DOM. When you call nodes.item(0), it returns an Element node that
represents the <node10> element. To get the textual content of an element, you can't
call getNodeValue() directly on the Element node; rather, you have to have to get a TextNode
object, which is a child of the Element node, and then call getNodeValue() on that.

- Rob

  ----- Original Message ----- 
  From: Denero Watz 
  To: axis-user@ws.apache.org 
  Sent: Saturday, July 26, 2003 10:53 PM
  Subject: Retrieving a value from the Soap response ....


  Hi
     I have written a soap client(using apache soap api) and the structure of the response
from the server is similar to this:
  ...
  ...
    <name9>valueOf9<name9>
     <name10>valueOf10</name10>
  ...
  ...

  Now, I am retrieving the value of 'name10' like this:
  Parameter result = response.getReturnValue();
  Element root = (Element) result.getValue();
  NodeList nodes = root.getElementsByTagName("name10");
  message = nodes.item(0).getNodeValue();
  The value of the message is null here. Can someone tell me what is wrong here?

  But I got it working by modifying the above by:
  message = nodes.item(0).getFirstChild().getNodeValue();
  This returns 'valueOf10'. But from the above structure you can see that 'valueOf10' is not
a node, so why I have to get the first child of 'name10' to retrive this value.

  Or am I missing something here??

  Thanks,
  dw




------------------------------------------------------------------------------
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free, easy-to-use web site design software
Mime
View raw message