Define input to web service

I started using Yii this week and think that it’s working great!

I have created a web service which is working. It takes input via the controller and saves it with the model class.

However, I want the input array called $datalist to be more specific. That is, I want the generated WSDL to show the exact structure that should be sent in as input like below:

Right now it will only show datalist as an input parameter, and not the structure with id and name. The input parameters in my controller looks like below. How can I define it so that the WSDL is generated with these?

I finally solved it. The solution is to point the input array in the doc comments towards a class:

Then in your model or other class (NameOfYourClass), you need to define each attribute that should be generated within <datalist></datalist> . Example:

Hope that this helps someone.


Can you please tell me how to create webservice in yii.

Hi shilpa,

This forum post is already resolved. You should create a new post if you have questions.

To create a web service with yii, you should first read the tutorial at this link: