getting an object from SoapClient

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jacques Lebastard

    getting an object from SoapClient


    Hi there,

    I'm new to the SOAP PHP5 extension. It works fine for web service
    methods that returns basic types (string,int,... ). However, for methods
    that return an object of a class I defined, I can't access the object,
    though the SOAP response looks correct.

    Here the received SOAP message :

    Response:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap .org/soap/envelope/"
    xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns:ns1=""
    xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap .org/soap/encoding/"
    SOAP-ENV:encodingSty le="http://schemas.xmlsoap .org/soap/encoding/">
    <SOAP-ENV:Body><SOAP-ENV:getOBjectRe sponse><return xsi:type="ns1:A User">
    <cn xsi:type="xsd:s tring">JACQUES LEBASTARD</cn>
    <givenname xsi:type="xsd:s tring">Jacques</givenname>
    <sn xsi:type="xsd:s tring">Lebastar d</sn>
    <mail xsi:type="xsd:s tring">jacques. lebastard@evidi an.com</mail>
    </return></SOAP-ENV:getOBjectRe sponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

    The returned object looks as a SoapVar where I was expecting an object
    of class 'User' (the 'AUser' given as enc_stype is the ComplexType
    defined in the WSDL):

    object(SoapVar) #3 (4) {
    ["enc_type"]=> int(0)
    ["enc_value"]=> object(stdClass )#2 (4) {
    ["cn"]=> string(17) "JACQUES LEBASTARD"
    ["givenname"]=> string(7) "Jacques"
    ["sn"]=> string(9) "Lebastard"
    ["mail"]=> string(29) "jacques.lebast ard@evidian.com "
    }
    ["enc_stype"]=> string(5) "AUser"
    ["enc_ns"]=> string(0) ""
    }

    What did I miss in the WSDL or web service definition?
Working...