Importing Yii Created Soap Server To Visual Studio

I created a SOAP server using this tutorial:

http://www.yiiframework.com/doc/guide/1.1/en/topics.webservice

My web-service URL is:

http://lms.irc.ac.ir/extras/millms/mws/system/service

This Yii web-service is embedded in moodle (an open source LMS) and is going to be used in an ASP application. The ASP guy told me he can see functions, but he can not import it in Visual studio. Another matter to say is that I can use it’s functions in PHP:




<meta charset=utf8>

<pre>

    <?php

    $client=new SoapClient('http://lms.irc.ac.ir/extras/millms/mws/system/service');

    $res = $client->ListAllCourses();

    var_dump($res);

    ?>

</pre>



A correct example of a web-service that can be imported in visual studio is:

http://www.mihansmscenter.com/webservice/index.php?wsdl

Also there is no authentication required.

What is My fault?

Yii generates WSDL using the rpc/encoded style and most other enviroments require document/literal. I’ve made some pull-requests porting support for document/literal from Zend but it still awaits on Github to be accepted, hopefully it’s going to be in 1.1.15.

So you think there is no way to import functions in ASP? As you say Yii WSDL is rpc/encoded, how about adding this capability to visual studio (is there any module available?)

Sorry, I don’t use Visual Studio. You could try to use my WSDL generator like so:




    public function actions() {

        return array(

            'wsdl'=>array(

                'class'=>'DocLitWebServiceAction',

            ),

        );

    }



Hello, I don’t wanna be a dick!, but how I can use your DocLitWebServiceAction?

Just use it instead of CWebServiceAction like I showed you.

I did that, but the result shows that it’s in RPC format yet.

http://lms.irc.ac.ir/extras/millms/mws/system/service

Is there any options available in your files to create literal results?

I’m sorry, I haven’t checked those classes thoroughly enough. I forgot one more file and some options:




	public function actions() {

		return array(

			'wsdl'=>array(

				'class'=>'DocLitWebServiceAction',

				'serviceOptions' => array(

					'generatorConfig' => array(

						'class' => 'HeadersWsdlGenerator',

						//'namespace' => 'http://namespace_url,

						//'serviceName' => 'NamespaceWsdl',

						'operationBodyStyle'=>array('use'=>'literal'),

						'bindingStyle'=>'document',

					),

				),

			),

		);

	}




Thanks, I think I am there’s two steps from heaven: Object configuration must be an array containing a “class” element.

Please provide more information, like a stack trace or a line number. Also, post your actions() method.

I did all you said, but there is some errors yet. You have helped me very much. Any other clue(s), resources you know that may help me?

This is my action method:




    public function actions()

    {

        return array(

            'service'=>array(

//                'class'=>'application.services.DocLitWebServiceAction',

//                'class'=>'application.services.DocLitWebServiceAction',

//                'class'    => 'ext.GWebService.GSoapServerAction',

                'class'=> 'application.services.DocLitWebServiceAction',

                'serviceOptions' => array(

                     'generatorConfig' => array(

                        'class' => 'application.services.HeadersWsdlGenerator',

                        //'namespace' => 'http://namespace_url,

                        //'serviceName' => 'NamespaceWsdl',

                        'operationBodyStyle'=>array('use'=>'literal'),

                        'bindingStyle'=>'document',

                    ),

                ),

            ),

        );

    }

 



But the problem exsists yet. I also got your files on github, but your action method results to []




    public function actions() {

        return array(

            'wsdl'=>array(

                'class'=>'CWebServiceAction',

                'serviceOptions' => array(

                    'generatorConfig' => array(

                        'class' => 'CWsdlGenerator',

                        'operationBodyStyle'=>array('use'=>'literal'),

                        'bindingStyle'=>'document',

                    ),

                ),

            ),

        );

    }

  



I can’t help any further if you don’t post your error messages, possibly along with the stack trace.

  1. I downloaded github version of framework.

  2. I used your action method.

  3. when I type my webservice url in browser I see


[]

instead of wsdl, so there is no error. i.e. no wsdl is created at all.

You have any clue how I can use zend framwork 2 to create wedl?

nineinchnick, thanks so much for posting those files. It’s saved me tons of hours doing that coding myself.

The parts that weren’t really mentioned are where to put the files. I ended up creating a services directory under protected for DocLitWebServiceAction.php and HeadersWsdlGenerator.php, then referencing them as application.services.____ in the class references. DocLitWebService.php worked just fine under components. That was about all I noticed that wasn’t really documented above.

Again, thanks for posting the files. It was a huge help.