Yii Framework Forum: CWebServices Complex / Composite types - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CWebServices Complex / Composite types Having problems with composite/complex types Rate Topic: -----

#1 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 07 July 2010 - 07:23 AM

Hi,

I'm evaluating Yii 1.1.3 for use in a SOA project and am having problems with complex (or composite) types. I have read other posts about this matter, but cannot seem to find a solution. I have also read this documentation page on the topic, but am still having problems. Here's what I have:

<?
require_once('includes/dbaccess.php');
require_once('includes/test.php');

class WriteController extends CController
{
  public function actions()
  {
    return array(
      'methods' => array(
        'class' => 'CWebServiceAction',
	'classMap' => array(
	  'TestClass' => 'TestClass',
	),
      ),
    );
  }

  /**
   * method: submit_captured_data
   * Submits some arbitrary captured data.
   * Returns true.
   *
   * @param TestClass[] captured_data An array of captured data.
   * @return TestClass[] Testing testing testing.
   * @soap
   */
  public function submit_captured_data($captured_data)
  {
    $retval = $captured_data;
    return $retval;
  }
  ...


My includes/test.php looks like this:

<?
  class TestClass
  {
    /*
     * @var string
     * @soap
     */
    public $param1;
		
    /* 
     * @var string
     * @soap
     */
    public $param2;
  }
?>


The composite type TestData is not properly generated in the WSDL (no param1 and param2 of type string):

...
<xsd:schema targetNamespace="urn:WriteControllerwsdl">
  <xsd:complexType name="TestClassArray">
    <xsd:complexContent>
      <xsd:restriction base="soap-enc:Array">
        <xsd:attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:TestClass[]"/>
      </xsd:restriction>
    </xsd:complexContent>
  </xsd:complexType>
  <xsd:complexType name="TestClass">
    <xsd:all/>
  </xsd:complexType>
...


Any help would be really appreciated.

Thanks in advance.
0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 07 July 2010 - 09:01 AM

View PostScott Deagan, on 07 July 2010 - 07:23 AM, said:

...
Any help would be really appreciated.


Did you disable the wsdl cache (or at least set it to a time frame you can afford to wait :) ). I like to use 60 seconds, that way I can see the difference.

/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#3 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 07 July 2010 - 09:29 AM

Hi Tommy. Thanks for your reply. My SOAP cache is completely disabled (soap.wsdl_cache_enabled=0). Any changes I make to the SOAP methods are immediately available, so I don't think it's a cache problem.
0

#4 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 07 July 2010 - 07:21 PM

I found the problem - it seems that Yii is very touchy about the asterisks characters in the comments:

<?
  class TestClass
  {
    /*
     * @var string
     * @soap
     */
    public $param1;
                
    /* 
     * @var string
     * @soap
     */
    public $param2;
  }


should have been:

<?
  class TestClass
  {
    /**
     * @var string
     * @soap
     **/
    public $param1;
                
    /** 
     * @var string
     * @soap
     **/
    public $param2;
  }


Interestingly, I found that the web service works fine even without classMap defined.

Yii is the coolest! ::)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users