This seems to be an issue that is related to how XML messages are processed in Axis2. I have simplified my example and have noticed that XPath expressions function differently depending on how the XML fragment was constructed. I cannot get an XPath expression to work in an Axis2 service, but I can use the exact same expression on the exact same xml fragment (created with StaXOMBuilder), and it works.
Here is a sample XML: <ns:makesGet xmlns:ns="http://www.whisolutions.com/PartSelectService/2008-10-07"> <makesGetParms> <PSSAccessKey>Joe</PSSAccessKey> <Password>1</Password> <Year>1998</Year> <UseConfig>y</UseConfig> <Version>2008-10-07</Version> <!--You may enter ANY elements at this point--> </makesGetParms> </ns:makesGet> The following code returns results when the XML was built with the StaXOMBuilder. It does not return results inside an Axis2 web service, for the same fragment: String xpathString = "/a:makesGet/makesGetParms/PSSAccessKey"; AXIOMXPath xpathExpression = new AXIOMXPath (xpathString); xpathExpression.addNamespace("a", "http://www.whisolutions.com/PartSelectService/2008-10-07"); List listOfNodes = xpathExpression.selectNodes(documentElement); In the web service, I am using the OMElement that is passed to me by the RawXMLINOutMessageReceiver. When I get this element, I process it as follows, before trying the XPath: element.build(); element.detach(); I also tried declaring the namespace: element.declareNamespace("http://www.whisolutions.com/PartSelectService/2008-10-07", "ns"); In Eclipse, here are the base properties of the OMElement in an Axis2 web service (Note that when I declare the namespace, I see it, but it doesn't make the XPath work): http://www.nabble.com/file/p19860410/soap.jpg Here are the properties of the OMElement built by the StaxOMBuilder: http://www.nabble.com/file/p19860410/stax.jpg Has anyone successfully used XPath in a web service where the WSDL has a namespace? Here is my current WSDL: http://www.nabble.com/file/p19860410/PartSelect_v1_0.wsdl PartSelect_v1_0.wsdl -- View this message in context: http://www.nabble.com/Is-there-a-bug-with-Axiom-XPath-and-Multiple-namespaces--tp19723540p19860410.html Sent from the Axis - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
