note 67904 added to function.soap-soapclient-dorequest
| From: | php-general at lists dot php dot net | Date: | Thu, 06 Jul 2006 08:17:44 +0000 |
| Subject: | note 67904 added to function.soap-soapclient-dorequest | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114486@lists.php.net to get a copy of this message | ||
Do you have problems with the PHP5 SoapClient when you need to send a request to a service with a
ComplexType parameter?
Maybe because my service is build in Delphi with REMObjects SDK 3.0 I had the problems, maybe not.
Anyway, this was my remedy:
<?php
$versie = new stdClass();//define a basic class object
$versie->versieID = $aVersie->versieID();//fill it with the exact attributes as your
complextype Object in the wsdl is
$versie->versieNummer = $aVersie->versieNummer();
$versie->isActief = $aVersie->isActief();
$soapVersieType = new SoapVar($versie , SOAP_ENC_OBJECT, "Versie", "http://127.0.0.1:8999/SOAP?wsdl"); //create
the complex soap type, Versie is the name of my complex type in the wsdl, the latter url beeing the
location of my wsdl.
try{
$result = $soapClient->BewaarVersie($this->sessieId,$soapVersieType); //BewaarVersie is a
function derived from my WSDL with two params.
}
catch(SoapFault $e){
trigger_error('Something soapy went wrong: '.$e->faultstring,E_USER_WARNING);
}
?>
After some more testing i found out that the conversion to the StdClass() object was not required.
My 'Versie' local object has the attributes for the 'Versie' wsdl complex type
defined as private vars and give no pain when i create the SoapVar with an instance of the local
'Versie' Object.
----
Server IP: 194.109.193.119
Probable Submitter: 62.58.29.82 (proxied: 10.15.7.59)
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapclient-dorequest.php
Edit -- http://master.php.net/note/edit/67904
Del: integrated -- http://master.php.net/note/delete/67904/integrated
Del: useless -- http://master.php.net/note/delete/67904/useless
Del: bad code -- http://master.php.net/note/delete/67904/bad+code
Del: spam -- http://master.php.net/note/delete/67904/spam
Del: non-english -- http://master.php.net/note/delete/67904/non-english
Del: in docs -- http://master.php.net/note/delete/67904/in+docs
Del: other reasons-- http://master.php.net/note/delete/67904
Reject -- http://master.php.net/note/reject/67904
Search -- http://master.php.net/manage/user-notes.php