Pass parameter to SOAP

0

When trying to make a request in a WS SOAP, the request works, but the parameters do not. Code:

$allquery = $request->getQueryParams();
$unidade = $allquery['unidade'];
$sub = $allquery['sub'];
$senha = $allquery['senha'];
$soapcliente = new SoapClient('http://aluno.doup.uses.com.br/webservice/wsaluno.php?wsdl', array('trace' => 1));
//valores do array deve ser igual do xml de requisição
$params = array('unidade'=>$unidade, 'subscricao'=>$sub,'senha'=>$senha);
$usuariouses = $soapcliente->initLogin($params);
echo "REQUEST:\n" . $soapcliente->__getLastRequest() . "\n";

Instead of the first parameter it returns "Array" instead of the drive. The answer he gives me:

    <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:uses.doup.areadoaluno" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:initLogin>
            <unidade xsi:type="xsd:string">Array</unidade>
            <subscricao xsi:nil="true"/>
            <senha xsi:nil="true"/>
        </ns1:initLogin>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

You should do the request like this:

    <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:uses.doup.areadoaluno">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:initLogin soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <unidade xsi:type="xsd:string">Praia da Costa</unidade>
         <subscricao xsi:type="xsd:integer">000</subscricao>
         <senha xsi:type="xsd:string">xxx</senha>
      </urn:initLogin>
   </soapenv:Body>
</soapenv:Envelope>
    
asked by anonymous 31.01.2018 / 19:15

0 answers