Re: Object hasn't xxx property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 07 Jan 2007 16:32:07 +0200, Ville Mattila <ville@pmd.fi> wrote:

Hello,

I have created a SOAP Server with built-in functions (PHP 5.2.0).
Server is running in WSDL mode and works fine, until now when I'd need
to return a complex type object to the client, when "Object hasn't
'userID' property" error is raised from server side. I have tried
different ways to return the object from the handling class, but the
error remains the same.

WSDL definitions of the complextype object:
    <complexType name="objUserDetails">
     <sequence>
      <element name="userId" type="xsd:long"/>
      <element name="firstName" type="xsd:string"/>
      <element name="lastName" type="xsd:string"/>
     </sequence>
    </complexType>

Response definition:
<message name="authUserResponse">
	<part name="authenticatedUserDetails" type="tns:objUserDetails" />
</message>

And finally, the returning code at handling class:
return array(
	'authenticatedUserDetails' => array(
		'userId' => 100,
		'firstName' => 'Ville',
		'lastName' => 'Mattila'							)
);

I have tried also returning SoapVar, SoapParam as well as stdClass with
given properties.

Any help is appreciated,

Ville

Try defining an object that matches your type:

class objUserDetails {
  public userId;
  public firstName;
  public lastName;
}

and then return an instance of it:

$d = new objUserDetails();
$d->userId = 1;
$d->firstName = "Joe";
$d->lastName = "Bloggs";

return array('authUserResponse' => $d);

Hope this helps

Adam Ashley

Attachment: pgpbbpgx834sv.pgp
Description: PGP Digital Signature


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux