Hi,
I have a problem which I think is something to do with my schema or how I get the Element value of a set of nodes.
My schema generates the wsdl and allows me to make a request for a set of values which are 1 or more:
<Addresses>
<Contact>
<Details>
<ContactName>fred</ContactName>
..............
</Details>
</Contact>
<Contact>
<Details>
<ContactName>john</ContactName>
..............
</Details>
</Contact>
</Addresses>
Everything works fine, my end point gets invoked as it should and I can create a Contact object with the values populated as expected. However all the contacts have the values of the first <Contact>.
I am calling selectNodes and iterating over the elements, then calling valueOf using the XPath object of those Element objects.
If I make the request with more than one <Contact> the loop iterates over all those objects but each Contact object has the values from the first <Contact>Code:List contacts = this.contact.selectNodes(addressRequest); for(Object contactObj : contacts) { Element contactElement = (Element)contactObj; Contact contact = new Contact(); contact.setName(this.contactName.valueOf(contactElement)); }
contactName is the XPath declaration in the end point constructor which has the schema name space added, like this:
Can anyone see why each time I call contactName.valueOf on each <Contact> Element I only get the first values in the set?Code:contactName = XPath.newInstance("//myTNS:ContactName"); contactName.addNamespace(namespace)
Many thanks,
John


Reply With Quote