PHP Classes
elePHPant
Icontem

detect type array

Recommend this page to a friend!

      SOAP Proxy  >  All threads  >  detect type array  >  (Un) Subscribe thread alerts  
Subject:detect type array
Summary:detect type array
Messages:3
Author:lplover2k
Date:2011-11-04 12:01:50
Update:2011-11-10 13:48:36
 

 


  1. detect type array   Reply   Report abuse  
lplover2k - 2011-11-04 12:01:50
hi,

First, i want to thank you for your great soap proxy class! it is great!

I want to be able to detect arrays? do you know if it is possible? e.g. at line 268 of SoapProxyGenerator.php, add an attribute "is_array"

$soapTypes[] = array(
'type' => $soapTypeName,
'name' => $typeName,
'fields' => $fields,
'base' => $base
'is_array' => $is_array
);

there seems to have 2 ways to define arrays in a wsdl

fusesource.com/docs/framework/2.4/w ...

I think you can't determine if a "type" is an array with the default php5 __getTypes() function... you might need to look at the wsdl directly imo...


  2. Re: detect type array   Reply   Report abuse  
Przemek Berezowski - 2011-11-04 20:04:39 - In reply to message 1 from lplover2k
Hi,

I supose its possible to find whether a soap type is an array or not.
I'll look in it next week and let you know.

  3. Re: detect type array   Reply   Report abuse  
Przemek Berezowski - 2011-11-10 13:48:36 - In reply to message 1 from lplover2k
Hi,

Right now arrays are recognized, but becouse of php is not strongly typed lang, they are wrapped into objects. But I've tested two behaviors

1:
On the input of webmethod there is an array of int
On the output of webmethod there is an array of int

so the code to invoke this method is:

$p2 = new TestParam_TestO2();
$p2->paramIn = array(1,2,3);

$res = $service->TestO2($p2);
print_r($res);

and the display is:
TestParam_TestO2Response Object
(
[TestO2Result] => TestParam_ArrayOfInt Object
(
[int] => Array
(
[0] => 2
[1] => 4
[2] => 6
)
)
)

Yes I know - It might be confusing , but its works :)
2:
On the input of webmethod there is an array of int
On the output of webmethod there is an array of user defined type

so the code to invoke this method is:

$p3 = new TestParam_TestO3();
$p3->paramIn = array(1,2,3);

$res = $service->TestO3($p3);
print_r($res);

and the display is:
TestParam_TestO3Response Object
(
[TestO3Result] => TestParam_ArrayOfOut3 Object
(
[Out3] => Array
(
[0] => TestParam_Out3 Object
(
[myField] => 2
)

[1] => TestParam_Out3 Object
(
[myField] => 4
)

[2] => TestParam_Out3 Object
(
[myField] => 6
)
)
)
)

confusing once again, but also works.

I will try to do something with this - but dont have time right now. I think expected behavior is to return array of object without wrapping it with extra object, so it looks like:

TestParam_TestO2Response Object
(
[TestO2Result] => Array
(
[0] => 2
[1] => 4
[2] => 6
)
)
)

--
Przemo