You are here: getting an object from SoapClient « PHP Programming Language « IT news, forums, messages
getting an object from SoapClient

Posted by Jacques Lebastard on 06/20/06 07:54

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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body><SOAP-ENV:getOBjectResponse><return xsi:type="ns1:AUser">
<cn xsi:type="xsd:string">JACQUES LEBASTARD</cn>
<givenname xsi:type="xsd:string">Jacques</givenname>
<sn xsi:type="xsd:string">Lebastard</sn>
<mail xsi:type="xsd:string">jacques.lebastard@evidian.com</mail>
</return></SOAP-ENV:getOBjectResponse></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.lebastard@evidian.com"
}
["enc_stype"]=> string(5) "AUser"
["enc_ns"]=> string(0) ""
}

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация