object - PHP Soap client with complex types -


i trying request structure:

<soap-env:body>   <ns1:getcreditreporttypes>     <reporttyperequest>       <reportparams xsi:type="ns1:personcreditreportparams">         <personid>4</personid>         <consentconfirmed>true</consentconfirmed>       </reportparams>     </reporttyperequest>   </ns1:getcreditreporttypes> </soap-env:body> 

here php-code:

$obj = new \stdclass(); $obj->personid = 4; $obj->consentconfirmed = true; $data = new \soapvar($obj, soap_enc_object, "personcreditreportparams", $namespace, "reportparams"); $res = $this->client->getcreditreporttypes(new \soapparam($data,"reporttyperequest")); 

however, php generates invalid xml:

<soap-env:body>   <ns1:getcreditreporttypes xsi:type="ns1:personcreditreportparams">     <consentconfirmed>true</consentconfirmed>     <personid>4</personid>   </ns1:getcreditreporttypes> </soap-env:body> 

how can make valid xml object-way?

for who'll same problem. solution use nusoap (https://github.com/yaim/nusoap-php7). library allows make complicated requests, including swa (soap attachments). here working code question:

$person = array("personid"=>$id, "consentconfirmed"=>$confirmed); $data = array(   "reportparams"=>new soapval("reportparams", "personcreditreportparams", $person, false, $namespace) ); $result = $client->call("getcreditreporttypes", $data, $namespace); 

p.s. i've tried generators , no 1 make correct request, although classes generated correctly.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -