Ricorocks-Digital-Agency / Soap

A Laravel SOAP client that provides a clean interface for handling requests and responses.
MIT License
405 stars 34 forks source link

Nodes parameters with namespace? #56

Open AbrilMontaldo opened 1 year ago

AbrilMontaldo commented 1 year ago

This is my wsdl

<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:alt="http://aaa.com/"
    xmlns:req="http://bbb.com"
    xmlns:req1="http://ccc.com/"
>
   <soapenv:Header/>
   <soapenv:Body>
      <alt:altaDeDeudas>
         <!--Optional:-->
         <requerimientoAltaDeDeudas>
            <req:cabecera>
               <idRequerimiento>?</idRequerimiento>
               <ipCliente>?</ipCliente>
               <timeStamp>?</timeStamp>
               <idEntidad>?</idEntidad>
               <canal>?</canal>
            </req:cabecera>
            <req1:ente>?</req1:ente>
            <req1:usuario>?</req1:usuario>
         </requerimientoAltaDeDeudas>
      </alt:altaDeDeudas>
   </soapenv:Body>
</soapenv:Envelope>

And this is my code so far

$client = Soap::to($wsdl)
                ->withHeaders($wsseHeader)
                ->withOptions([
                    'trace'      => true,
                    'proxy_host'     => $proxyHost,
                    'proxy_port'     => $proxyPort,
                ])
                ->trace();

$body = Soap::node([])
    ->body([
        'requerimientoAltaDeDeudas' => Soap::node([])
            ->body([
                'cabecera' => Soap::node([])->body([
                    "idRequerimiento" => "aa",
                    "ipCliente" => $params['ip'],
                    "timeStamp" => "", 
                    "idEntidad" => "",
                    "canal" => "",
                ]),
                'ente' => '',
                'usuario' => '', 
            ])
    ]);

$response = $client->altaDeDeudas($body);

But i get an error saying that element are expected as <{http://aaa.ar/}cabecera>, <{..}ente> ..... How can i define those namespaces/schemas on every node?

rico commented 1 year ago

Same question here ...