Bug #47492 [Com]: SOAP_SINGLE_ELEMENT_ARRAYS has no effect
Edit report at https://bugs.php.net/bug.php?id=47492edit=1 ID: 47492 Comment by: jboffel at gmail 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 Private report: N New Comment: Hi all, I think for people without WSDL, you shouldn't expect SOAP_SINGLE_ELEMENT_ARRAYS to work. To know it, SoapClient need a XSD saying it could be or not more than one result to decide it must be in array or not. Just with SOAP answer it is technically impossible to make a difference between an anwser that is just 1 element but could have N and an answer that is known to be only 1. Exemple : body brotherdetailage: 17/brotherdetail /body body brotherdetailage: 17/brotherdetail brotherdetailsister : 1/brotherdetail /body In first case, if you don't have a XSD to say brotherdetail is a type and have rule maxOccurs = unbounded, how do you expect SoapClient will know it could have been more than one detail ? Of course with second example, SoapClient will now it could be because it'll find more than one so it will naturally make an array... Previous Comments: [2010-11-04 08:08:54] timothee dot groleau at mig33global dot com Oh duh, I forgot to add some version information: $ php -version PHP 5.3.3 (cli) (built: Oct 29 2010 14:24:39) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies I'm on Mac OS, php was installed from macports [2010-11-04 07:55:50] timothee dot groleau at mig33global dot com 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:stringtotalpages/key value xsi:type=xsd:double1.0/value /item item key xsi:type=xsd:stringtotalresults/key value xsi:type=xsd:int1/value /item item key xsi:type=xsd:stringchatrooms/key value xsi:type=ns2:Vector item xsi:type=ns2:Map item key xsi:type=xsd:stringname/key value xsi:type=xsd:stringtim_test/value /item item key xsi:type=xsd:stringid/key value xsi:type=xsd:string6/value /item item key xsi:type=xsd:stringstatus/key value xsi:type=xsd:stringACTIVE/value /item item key xsi:type=xsd:stringlanguage/key value xsi:type=xsd:stringENG/value /item /item /value /item item key xsi:type=xsd:stringpage/key value xsi:type=xsd:int1/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) } [2010-06-20 21:27:41] fel...@php.net 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
Bug #47492 [Com]: SOAP_SINGLE_ELEMENT_ARRAYS has no effect
Edit report at http://bugs.php.net/bug.php?id=47492edit=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:stringtotalpages/key value xsi:type=xsd:double1.0/value /item item key xsi:type=xsd:stringtotalresults/key value xsi:type=xsd:int1/value /item item key xsi:type=xsd:stringchatrooms/key value xsi:type=ns2:Vector item xsi:type=ns2:Map item key xsi:type=xsd:stringname/key value xsi:type=xsd:stringtim_test/value /item item key xsi:type=xsd:stringid/key value xsi:type=xsd:string6/value /item item key xsi:type=xsd:stringstatus/key value xsi:type=xsd:stringACTIVE/value /item item key xsi:type=xsd:stringlanguage/key value xsi:type=xsd:stringENG/value /item /item /value /item item key xsi:type=xsd:stringpage/key value xsi:type=xsd:int1/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] fel...@php.net 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 =
Bug #47492 [Com]: SOAP_SINGLE_ELEMENT_ARRAYS has no effect
Edit report at http://bugs.php.net/bug.php?id=47492edit=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: Oh duh, I forgot to add some version information: $ php -version PHP 5.3.3 (cli) (built: Oct 29 2010 14:24:39) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies I'm on Mac OS, php was installed from macports Previous Comments: [2010-11-04 07:55:50] timothee dot groleau at mig33global dot com 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:stringtotalpages/key value xsi:type=xsd:double1.0/value /item item key xsi:type=xsd:stringtotalresults/key value xsi:type=xsd:int1/value /item item key xsi:type=xsd:stringchatrooms/key value xsi:type=ns2:Vector item xsi:type=ns2:Map item key xsi:type=xsd:stringname/key value xsi:type=xsd:stringtim_test/value /item item key xsi:type=xsd:stringid/key value xsi:type=xsd:string6/value /item item key xsi:type=xsd:stringstatus/key value xsi:type=xsd:stringACTIVE/value /item item key xsi:type=xsd:stringlanguage/key value xsi:type=xsd:stringENG/value /item /item /value /item item key xsi:type=xsd:stringpage/key value xsi:type=xsd:int1/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) } [2010-06-20 21:27:41] fel...@php.net 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 ,
#47492 [Com]: SOAP_SINGLE_ELEMENT_ARRAYS has no effect
ID: 47492 Comment by: niek at signet dot nl Reported By: florian dot eberle at gmail dot com Status: Open Bug Type: SOAP related Operating System: Debian Lenny PHP Version: 5.2CVS-2009-02-24 (CVS) New Comment: I've the same problem; but I use WSDL with my SOAP. Previous Comments: [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/?id=47492edit=1
#47492 [Com]: SOAP_SINGLE_ELEMENT_ARRAYS has no effect
ID: 47492 Comment by: niek at signet dot nl Reported By: florian dot eberle at gmail dot com Status: Open Bug Type: SOAP related Operating System: Debian Lenny PHP Version: 5.2CVS-2009-02-24 (CVS) New Comment: This bug was filed a long time ago, still no replies. Is there going to be some kind of fix for this? Previous Comments: [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/?id=47492edit=1