Ajinkya
Ajinkya

Reputation: 22720

How to edit / format XML response in web service

I am using Apache Axis2 to write my first web service. I am following this official link.
I observed that if you call sample StockQuoteService given in link, it gives following properly indented response :

<ns:getPriceResponse xmlns:ns="http://pojo.service.quickstart.samples/xsd">
   <ns:return>42</ns:return>
</ns:getPriceResponse>  

I want response in specific XML format like

<answers>     // All answers should be in single `<answers>` tag.
  <answer> Answer1 </answer>   // Each Answer should be in `<answer>` tag.
  <answer> Answer2 </answer>
</answer>

How can I format XML response and add my XML tag ?

~Ajinkya.

Upvotes: 1

Views: 2167

Answers (2)

Ajinkya
Ajinkya

Reputation: 22720

Finally got it working http://www.marcusschiesser.de/?p=142 :)

Upvotes: 0

Tristan
Tristan

Reputation: 9141

You should use XSL Transformations (XSLT) to do this.

Upvotes: 2

Related Questions