xml - CodeIgniter + NuSOAP - Input multidimensional array -
i looking several times didn't find answer me, i'm asking , hope can me.
i have webservices in codeigniter application returns complex types , whatever, , need create service receive complex type this:
array ("position1" => 'mambo jambo', "position2" => 'more mambo jambo', "position3" => array("0" => array(), "1" => array()), "position4" => array("0" => array(), "1" => array());
in resume, complex type have normal data , inside 2 arrays receive n positions of array. need because receive invoice , in invoice receive n products (every 4 positions) , n quotas of payment (every value, date, etc).
i tryed create complex type 2 positions every of them other complex type array of complex type. yes, know, complex =p
is use when create output services return data this, input doesn't works. when try test in soapui app generate xml:
<soapenv:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:soapserverwsdl"> <soapenv:header/> <soapenv:body> <urn:gravanotafiscal soapenv:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <token xsi:type="xsd:string">?</token> <nota_fiscal xsi:type="ped:notafiscal" xmlns:ped="http://ultraman/tr1/sistema/api/pedidoservice?wsdl"> <!--you may enter following 7 items in order--> <filial xsi:type="xsd:string">?</filial> <numero xsi:type="xsd:string">?</numero> <serie xsi:type="xsd:string">?</serie> <dt_emissao xsi:type="xsd:string">?</dt_emissao> <valor xsi:type="xsd:string">?</valor> <itens_nota xsi:type="ped:itens_nota"/> <duplicatas_nota xsi:type="ped:duplicatas_nota"/> </nota_fiscal> </urn:gravanotafiscal> </soapenv:body> </soapenv:envelope>
last 2 positions "itens_nota" , "duplicatas_nota" need 2 arrays, soapui doesn't create right.
using "itens_nota" example, created 2 complex types this:
$this->nusoap_server->wsdl->addcomplextype( 'itemnf', 'complextype', 'struct', 'all', '', array( "filial" => array('name' => 'filial', 'type' => 'xsd:string'), "serie" => array('name' => 'serie', 'type' => 'xsd:string'), "nota_fiscal" => array('name' => 'nota_fiscal', 'type' => 'xsd:string'), "seq" => array('name' => 'seq', 'type' => 'xsd:string'), "pedido" => array('name' => 'pedido', 'type' => 'xsd:string'), "item" => array('name' => 'item', 'type' => 'xsd:string'), "qtd" => array('name' => 'qtd', 'type' => 'xsd:string') )
);
$this->nusoap_server->wsdl->addcomplextype("itens_nota", "complextype", "array", "", "soap-enc:array", array(), array(array("ref"=>"soap-enc:arraytype","wsdl:arraytype"=>"tns:arrayofstring[]")), "tns:itemnf" );
my input parameter "nota_fiscal", complex type , last 2 positions is:
"itens_nota" => array("name" => 'itens_nota', 'type' => 'tns:itens_nota'), "duplicatas_nota" => array("name" => 'duplicatas_nota', 'type' =>'tns:duplicatas_nota')
my arrays!
but doesn't works! know why? made mistakes?
if possible wanna example of how make service input arrays this, doesn't need problem, example give me direction.
thanks!
Comments
Post a Comment