Hi Garth,
You should be able to do this with Axiom itself...
opts.setAction("urn:wsgetVendor");
client.setOptions(opts);
OMElement res = client.sendReceive(createPayLoad());
You can use the "res" OMElement to access it's children...
Try adding the following to here..
Iterator children = res.getChildren();
while (children.hasNext())
{
OMNode node = (OMNode) children.next();
System.out.println(node.toString());
}
XMLStreamReader reader = XMLInputFactory.newInstance()
.createXMLStreamReader(
new
ByteArrayInputStream(res.toString().getBytes()));
StAXOMBuilder builder = new StAXOMBuilder(reader); // get the root
No need to do the above, since you already have a Axiom in place with
the web service response....
You can find some articles & tutorials about Axiom from here [1].
Thanks,
Thilina
[1] http://www.wso2.org/projects/axiom/java
// element (in
this
// case the
OMElement documentElement = builder.getDocumentElement();
OMDocument doc = builder.getDocument();
// OMNode node = doc.getFirstOMChild();
// OMNode sib = node.getNextOMSibling();
// System.out.println("sib = " + sib.toString());
// System.out.println("count = " + doc.getAttributeCount());
// dump the out put to console with caching
/*
* try { DocumentBuilderFactory factory = DocumentBuilderFactory
* .newInstance(); DocumentBuilder db =
factory.newDocumentBuilder();
* InputSource inStream = new InputSource();
* inStream.setCharacterStream(new StringReader(res.toString()));
* Document doc1 = db.parse(inStream); System.out.println("
doc1.version = " +
* doc1.getXmlVersion()); System.out.println(" doc1.baseuri = " +
* doc1.getBaseURI()); System.out.println(" doc1.docuri = " +
* doc1.getDocumentURI()); System.out.println(" doc1.inputencoding
= " +
* doc1.getInputEncoding()); System.out.println(" doc1.localname =
" +
* doc1.getLocalName()); System.out.println(" doc1.namespace = " +
* doc1.getNamespaceURI()); System.out.println(" doc1.nodename = "
+
* doc1.getNodeName()); System.out.println(" doc1.value = " +
* doc1.getNodeValue()); System.out.println(" doc1.prefix = " +
* doc1.getPrefix()); System.out.println(" doc1.textcontent = " +
* doc1.getTextContent()); System.out.println(" doc1.xmlencoding =
" +
* doc1.getXmlEncoding()); System.out.println(" doc1.type = " +
* doc1.getNodeType()); Element ele =
doc1.getElementById("address1");
* System.out.println(" ele = " + ele.toString()); } catch
(Exception e) {
* System.out.println(e); }
*/
}
public static OMElement createPayLoad()
{
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ttna.com/xsd",
"ns1");
OMElement method = fac.createOMElement("wsgetVendor", omNs);
OMElement value = fac.createOMElement("value", omNs);
value.setText("hsv");
method.addChild(value);
return method;
}
<end of java>}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Thilina Gunarathne
WSO2, Inc.; http://www.wso2.com/
Home page: http://webservices.apache.org/~thilina/
Blog: http://thilinag.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]