Edit report at http://bugs.php.net/bug.php?id=47492&edit=1

 ID:                 47492
 Comment by:         timothee dot groleau at mig33global dot com
 Reported by:        florian dot eberle at gmail dot com
 Summary:            SOAP_SINGLE_ELEMENT_ARRAYS has no effect
 Status:             Feedback
 Type:               Bug
 Package:            SOAP related
 Operating System:   Debian Lenny
 PHP Version:        5.2CVS-2009-02-24 (CVS)
 Block user comment: N

 New Comment:

Same problem here. xsi:type="ns2:Vector" entries are not translated to
arrays if there is only one element inside. Example below:







soap client created like so:

============================================================

$client = new soapclient(null, array(

  'location' => $soap_ejb_service_url,

  'uri' => $soap_ejb_service_name,

  'features' => SOAP_SINGLE_ELEMENT_ARRAYS | SOAP_USE_XSI_ARRAY_TYPE,

  'trace' => true)

);

$response = $client->__soapCall($function, $parameters);

============================================================





raw soap response:

============================================================

<?xml version='1.0' encoding='UTF-8'?>

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>

<SOAP-ENV:Body>

<ns1:searchChatroomResponse xmlns:ns1="urn:fusion"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>

<return xmlns:ns2="http://xml.apache.org/xml-soap"; xsi:type="ns2:Map">

<item>

<key xsi:type="xsd:string">totalpages</key>

<value xsi:type="xsd:double">1.0</value>

</item>

<item>

<key xsi:type="xsd:string">totalresults</key>

<value xsi:type="xsd:int">1</value>

</item>

<item>

<key xsi:type="xsd:string">chatrooms</key>

<value xsi:type="ns2:Vector">

<item xsi:type="ns2:Map">

<item>

<key xsi:type="xsd:string">name</key>

<value xsi:type="xsd:string">tim_test</value>

</item>

<item>

<key xsi:type="xsd:string">id</key>

<value xsi:type="xsd:string">6</value>

</item>

<item>

<key xsi:type="xsd:string">status</key>

<value xsi:type="xsd:string">ACTIVE</value>

</item>

<item>

<key xsi:type="xsd:string">language</key>

<value xsi:type="xsd:string">ENG</value>

</item>

</item>

</value>

</item>

<item>

<key xsi:type="xsd:string">page</key>

<value xsi:type="xsd:int">1</value>

</item>

</return>

</ns1:searchChatroomResponse>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

============================================================





$response returned by php client:

============================================================

array(4) {

  ["totalpages"]=>

  float(1)

  ["totalresults"]=>

  int(1)

  ["chatrooms"]=>

  object(stdClass)#2 (1) {

    ["item"]=>

    array(16) {

      ["name"]=>

      string(8) "tim_test"

      ["id"]=>

      string(1) "6"

      ["status"]=>

      string(6) "ACTIVE"

      ["language"]=>

      string(3) "ENG"

    }

  }

  ["page"]=>

  int(1)

}

============================================================


Previous Comments:
------------------------------------------------------------------------
[2010-06-20 21:27:41] [email protected]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------
[2009-11-27 13:45:55] niek at signet dot nl

This bug was filed a long time ago, still no replies. Is there going to
be some kind of fix for this?

------------------------------------------------------------------------
[2009-11-27 08:35:52] niek at signet dot nl

I've the same problem; but I use WSDL with my SOAP.

------------------------------------------------------------------------
[2009-02-24 13:33:47] florian dot eberle at gmail dot com

Description:
------------
The Feature SOAP_SINGLE_ELEMENT_ARRAYS has no effect when I try to get a
resultset that sometimes contains only one Object. It always removes the
array and returns the Object without the array.



See Example Code for additional information and feel free to contact me
for additional information.

Reproduce code:
---------------
<?php

$options = array(

    'location' => 'http://u8020.intx.ch.netstream.com/dnssoap/soap.cgi'
, 

    'uri' => 'http://dnstool.netstream.com/DnsAPI' , 

    'exceptions' => false , 

    'trace' => false , 

    'soap_version' => SOAP_1_1 , 

    'user_agent' => 'PHP DNS Client' , 

    'features' => SOAP_SINGLE_ELEMENT_ARRAYS

);

$soapserver = new SoapClient(null, $options);



//Watch Param type = A here  --> array 2 results expected here

$result = $soapserver->__soapCall('GetResourceRecords', 

    array(new SoapParam('wtf.com', 'zone') , new SoapParam('A', 'type')

    ));

var_dump($result);



//Watch Param type = MX here --> array with 1 result expected here

$result = $soapserver->__soapCall('GetResourceRecords', 

    array(new SoapParam('wtf.com', 'zone') , new SoapParam('MX',
'type')

    ));

var_dump($result);



?>

Expected result:
----------------
array(2) {

  ["total"]=>

  string(1) "2"

  ["records"]=>

  array(2) {

    [0]=>

    object(stdClass)#4 (7) {

      ["name"]=>

      string(4) "test"

      ["class"]=>

      string(2) "IN"

      ["data"]=>

      string(9) "127.0.0.1"

      ["id"]=>

      string(6) "160441"

      ["parameter"]=>

      string(0) ""

      ["ttl"]=>

      string(0) ""

      ["type"]=>

      string(1) "A"

    }

    [1]=>

    object(stdClass)#5 (7) {

      ["name"]=>

      string(4) "test"

      ["class"]=>

      string(2) "IN"

      ["data"]=>

      string(9) "127.0.0.1"

      ["id"]=>

      string(6) "160442"

      ["parameter"]=>

      string(0) ""

      ["ttl"]=>

      string(0) ""

      ["type"]=>

      string(1) "A"

    }

  }

}



array(2) {

  ["total"]=>

  string(1) "2"

  ["records"]=>

  array(1) {

    [0]=>

    object(stdClass)#4 (7) {

      ["name"]=>

      string(4) "stop.bugging.me"

      ["class"]=>

      string(2) "IN"

      ["data"]=>

      string(9) "32"

      ["id"]=>

      string(6) "160443"

      ["parameter"]=>

      string(0) "50"

      ["ttl"]=>

      string(0) "1337"

      ["type"]=>

      string(1) "MX"

    }

  }

}

Actual result:
--------------
array(2) {

  ["total"]=>

  string(1) "2"

  ["records"]=>

  array(2) {

    [0]=>

    object(stdClass)#4 (7) {

      ["name"]=>

      string(4) "test"

      ["class"]=>

      string(2) "IN"

      ["data"]=>

      string(9) "127.0.0.1"

      ["id"]=>

      string(6) "160441"

      ["parameter"]=>

      string(0) ""

      ["ttl"]=>

      string(0) ""

      ["type"]=>

      string(1) "A"

    }

    [1]=>

    object(stdClass)#5 (7) {

      ["name"]=>

      string(4) "test"

      ["class"]=>

      string(2) "IN"

      ["data"]=>

      string(9) "127.0.0.1"

      ["id"]=>

      string(6) "160442"

      ["parameter"]=>

      string(0) ""

      ["ttl"]=>

      string(0) ""

      ["type"]=>

      string(1) "A"

    }

  }

}

array(2) {

  ["total"]=>

  string(1) "1"

  ["records"]=>

  object(stdClass)#6 (7) {

    ["name"]=>

    string(15) "stop.bugging.me"

    ["class"]=>

    string(2) "IN"

    ["data"]=>

    string(2) "32"

    ["id"]=>

    string(6) "160443"

    ["parameter"]=>

    string(2) "50"

    ["ttl"]=>

    string(4) "1337"

    ["type"]=>

    string(2) "MX"

  }

}




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=47492&edit=1
  • Bug #47492 [Com]: SOAP_SINGLE_... timothee dot groleau at mig33global dot com

Reply via email to