php - NuSoap - Nested Array in addComplexType are allowed ? -
I need to get an XML input (with 2 or more elements) of this kind from the customer:
& lt; List & gt; & Lt; Items & gt; & Lt; Code xsi: type = "xsd: string" & gt; 123 & lt; / Code & gt; & Lt; Product xsi: type = "xsd: string" & gt; Hello & lt; / Products & gt; & Lt; Level xsi: type = "xsd: float" & gt; 3 & lt; / Level> & Lt; / Item & gt; & Lt; Items & gt; & Lt; Code xsi: type = "xsd: string" & gt; 1234 & lt; / Code & gt; & Lt; Product xsi: type = "xsd: string" & gt; Halo 2 & lt; / Products & gt; & Lt; Level xsi: type = "xsd: float" & gt; 4 & lt; / Level> & Lt; / Item & gt; & Lt; / List & gt;
Can I define a complex type like the description of the input parameters for the service method (an array (array (...)?
$ server -> wsdl-> add complex type ('name', 'complex type', 'structure', 'all', '', arrays (array ('code' => array ('name' => 'code', ' Type '=>' XSD: string '),' product '=> array (' name '=>' product ',' type '=>' xsd: string '),' level '=> array (' name '=' > 'Level', 'type' => 'xsd: float'));
$ server-> registers ('Updatecode', // method name array ('name' => 'tns: name'), // input parameter array ('returns' =>' xsd: string '), // output parameter' color: update code ', // namespace' vase: update code # updatecode ', // sort' rpg ', // style' encoded '// usage); function updateCode ($ input) {return calculation ($ input);}
When I use XML with 2 objects, I get 2 as a response; when I have only one object with 1 Use Ksmel do, I get 3 as 3 response (like the field of each item), where I expect the first results.
I do not understand why this happens
thanks,
The question is a little old, but I was working on something
Question 1) You have to declare 2 complex types where the first" list "is:
P>
$ soap-> Wsdl-> AddComplexType ('list', 'complex type', 'array', '', 'SOAP-ENC: arrays', array ('list' = & gt; array ('name' = & gt; 'list' Type '= & gt;' tls: item ')), array (array (' ref '= & gt;' tns: item ',' wsdl: arrayType '= & gt;' TNS: item [] ')), 'TNS: item');
And the second argument is "element":
$ soap-> gt; Wsdl-> AddComplexType ('item', 'element', 'structure', 'all', '', array ('code' = & gt; array ('name' = & gt; 'code', 'type' = & gt; 'Xsd: string'), 'product' = & gt; array ('name' = & gt; 'product', 'type' = & gt; 'xsd: string'), 'level' => 'Name' = & gt; 'level', 'type' = & gt; 'xsd: float')));
From here, should be sufficient to register the function using the above list type as input.
Question 2) To perform an actual AR count instead of counting:
array (1) {'item' = & gt; Array (2) {[0] = & gt; Array (3) {'code' = & gt; String (3) "123" 'product' = & gt; String (5) "Hello" 'Level' = & gt; Double (3)} [1] = & gt; Array (3) {'code' = & gt; String (4) "1234" 'Product' = & gt; String (6) "Hello2" 'Level' = & gt; Double (4)}}}
Comments
Post a Comment