Posted 03 October 2012 - 08:18 AM
I want to build a webservice that returns xml.
As far as I know with soap you create a bunch of methods that do a lot of stuff, ignoring the type of request.
Is it possible to create a restful api that returns xml?
in this link : http://www.yiiframew...ate-a-rest-api/
he created an api using rest and returning json. And the method CJSON::encode to turns objects into json .
is there a method that takes an object and generates xml?
sorry im kind of lost.
Posted 03 October 2012 - 09:17 AM
To generate the XML, you create your own views. Or maybe SimpleXML can help you.
Don't forget to set the proper XML response content-type using header.
Posted 03 October 2012 - 12:00 PM
If your models follow a predictable structure, you can write a class to do the conversion.