web services - How can i set attributes with NuSoap in PHP? -


i working nusoap build soap server. cant attributes way want.

i return value:

<return xsi:type="tns:taxatie">     <emailadres optin="1" xsi:type="tns:string">email@domain.com</emailadres> </return> 

and get:

<return xsi:type="tns:taxatie">     <emailadres optin="1" xsi:type="tns:emailadres">         <emailadres xsi:type="xsd:string">email@domain.com</emailadres>     </emailadres> </return> 

anyone know must change?

or how should set arrays?

this test code:

<?php require_once("nusoap.php"); $soapserver = new nusoap_server(); $soapserver->configurewsdl('thijs.test', 'urn:thijs.test');  $soapserver->wsdl->addcomplextype(     'taxatie',     'complextype',     'struct',     'all',     '',     array(         'emailadres' => array('name' => 'emailadres', 'type' => 'tns:emailadres')     ) );  $soapserver->wsdl->addcomplextype(     'emailadres',     'simpletype',     'struct',     'all',     '',     array(         "emailadres" => array('name' => 'emailadres', 'type' => 'xsd:string', 'minoccurs' => 0)     ),     array(         'optin' => array('name' => 'optin', 'type' => 'xsd:boolean', 'use' => 'required')     ) );  $soapserver->register('taxatie',                    // method name     array(),          // input parameters     array('return' => 'tns:taxatie'),    // output parameters     'urn:thijs.test',                         // namespace     'urn:thijs.test#taxatie',                   // soapaction     'rpc',                                    // style     'encoded',                                // use     'return something'        // documentation );  class taxatie {     var $emailadres = null;      function taxatie()     {         $this->emailadres = new emailadres();     } }  class emailadres {     var $emailadres = 'email@domain.com';     var $optin = true; }  function taxatie() {     return new taxatie(); }  $http_raw_post_data = isset($http_raw_post_data) ? $http_raw_post_data : ''; $soapserver->service($http_raw_post_data); 

thanks in advance

why not return array instead of using complex type?

e.g

$resultarray['taxatie'] = array(   'emailadres'  => $row["emailadres"],    'tagcount'    => $row["tagcount"],    'optin'       => $row["optin"] ); 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -