Problem while explorin SOAP web service


I’m trying out Yii’s SOAP features. I had no problem getting the simple quote example to work, but I cannot get the more complex post example to work.

The error is: "Description: looks like we got no XML document(sic)".

The offending code is:

  $post_client = new SoapClient('http://blah/webservice/post/service');

  $posts = $post_client->getPosts();

where the failure is in the call to getPosts().

However, a call to http://blah/webservice/post/service displays the WSDL, and it looks okay, and a call to __getFunctions() on the SoapClient displays:


[0] =>

'PostArray getPosts()'


The top of the stack trace is:

#0 [internal function]: SoapClient->__call('getPosts', Array)

#1 .../webservice/protected/controllers/SiteController.php(23): SoapClient->getPosts()

That ‘Array’ in __call looks odd.

Any ideas? Thanks.

Here’s the WSDL:

<?xml version="1.0" encoding="UTF-8"?>

<definitions xmlns="" xmlns:tns="urn:PostControllerwsdl" xmlns:soap="" xmlns:xsd="" xmlns:wsdl="" xmlns:soap-enc="" name="PostController" targetNamespace="urn:PostControllerwsdl">


  <xsd:schema targetNamespace="urn:PostControllerwsdl">

   <xsd:complexType name="PostArray">


     <xsd:restriction base="soap-enc:Array">

      <xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:Post[]"/>




   <xsd:complexType name="Post">


     <xsd:element name="id" type="xsd:integer"/>

     <xsd:element name="title" type="xsd:string"/>





 <wsdl:message name="getPostsRequest"/>

 <wsdl:message name="getPostsResponse">

  <wsdl:part name="return" type="tns:PostArray"/>


 <wsdl:portType name="PostControllerPortType">

  <wsdl:operation name="getPosts">


   <wsdl:input message="tns:getPostsRequest"/>

   <wsdl:output message="tns:getPostsResponse"/>



 <wsdl:binding name="PostControllerBinding" type="tns:PostControllerPortType">

  <soap:binding style="rpc" transport=""/>

  <wsdl:operation name="getPosts">

   <soap:operation soapAction="urn:PostControllerwsdl#getPosts" style="rpc"/>


    <soap:body use="encoded" namespace="urn:PostControllerwsdl" encodingStyle=""/>



    <soap:body use="encoded" namespace="urn:PostControllerwsdl" encodingStyle=""/>




 <wsdl:service name="PostControllerService">

  <wsdl:port name="PostControllerPort" binding="tns:PostControllerBinding">

   <soap:address location="http://blah/webservice/post/service/ws/1"/>




what is your doc comment to getPosts()?

Thanks for the offer of help, but I got there in the end. I had no:

  public static function model($className=__CLASS__) {

    return parent::model($className);


…in my Post model. I copied and pasted from the example instead of generating the model, and omitted to add it. Mea culpa.

Still, it was a useful exercise debugging SOAP in Yii.

I’ll suggest adding that line to the example to save someone else doing the same thing.