Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Traversing text/xml node in axis2/c |
|
Author |
|
shuaib
Joined: 22 Feb 2012 Posts: 1
|
Posted: Wed 22 Feb '12 17:36 Post subject: Traversing text/xml node in axis2/c |
|
|
I am very new to axis2/c and web services in general. My goal is to implement a service that takes in different values for an ethernet interface (e.g., ip address, name, etc) as input and make respective changes in the kernel of the target machine. It will be a POST REST method and for testing purpose, I am using Firefox REST client to send POST request. Thats how I am doing it:
Request Header:
Content-Type text/xml
Request Body:
<ns1:setInterface xmlns:ns1="http://localhost:9090/axis2/service_openapi">
<interface>
<name>eth0</name>
<ip>
<address>192.168.0.1</address>
<prefixlen>24</prefixlen>
</ip>
</interface>
</ns1:setInterface>
This request should invoke the setInterface service and after extracting the value of, i.e., <name>, <address> and <prefixlen> build up a stream and send packet to server application which will talk with kernel to do the required changes.
How do I traverse through such an xml structure ? I tried using built-in functions like
axiom_node_get_first_element(node, env);
axiom_node_get_first_child(node, env);
I followed the echo example in axis2/c but I couldn't retrieve anything beyond first element and its value. I am not able to traverse further properly and extract the values. Does anyone have any good pointers to an example which explains this ?
Furthermore, in this given Request body, is <interface> element of node <setInterface> or its child ? Similarly, <interface> has <name> and <ip> (as its child or elements?), and <ip> has <address> and <prefixlen>. How do we interpret this XML structure in AXIS2/C terminology ?
Once again my question could be totally naive but XML and AXIS2/C are all very new to me and I really want to understand this.
Many thanks for your time. |
|
Back to top |
|
|
|
|
|
|