Preciso consumir uma wsdl porem o XML para envio ao servidor do webservice possui atributos. Criei um array contendo todos as tags, porem fiquei na duvida de como adicionar os atributos de cada tag.
XML que deve ser enviado ao servidor:
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ws='http://ws.document.general.modules.opengtm.com.br/'>
<soapenv:Header/>
<soapenv:Body>
<ws:receiveDocument>
<ws:login>[email protected]</ws:login>
<ws:password>123</ws:password>
<ws:xmlDocument>
<![CDATA[
<documents>
<document code='959559' operationDate='01/05/2018 12:21:00' isTicket='false' type='EN' fullWeight='38544' vehicleWeight='15870'>
<owner document='23117229000106' name='SEND PHP' />
<truck code='KAZ' serial='2931' />
<carrier document='18822165000104' name='Reitran Transportes Ltda Me' />
<item amount='1' lot='CAR' weight='22674'>
<product code='102540' description='CAR BLACK' />
</item>
</document>
</documents>
]]>
</ws:xmlDocument>
</ws:receiveDocument>
</soapenv:Body>
</soapenv:Envelope>";
Meu Array
$lst = array('receiveDocument' => array("login" => "[email protected]",
"password" => "123",
"xmlDocument" => array(array("documents" => array("document" => (array('code' => '959580', 'operationDate' => '01/05/2018 12:21:00', 'isTicket' => 'false', 'type' => 'EN', 'fullWeight' => '38544', 'vehicleWeight' => '15870',
array(
array("owner" => array('document' => '23117229000106', 'name' => 'SEND PHP')),
array("truck" => array('code' => 'KAZ', 'serial' => '2931')),
array("carrier" => array('document' => '18822165000104', 'name' => 'Reitran Transportes Ltda Me')),
array("item" => array('amount' => '1', 'lot' => 'CAR', 'weight' => '22674', array("product" => array('code' => '102540', 'description' => 'CAR BLACK'))))))
))))
)
);
try {
$url = 'http://192.168.0.89:8980/app/services/integrationDocument?WSDL';
$webService = new \SoapClient($url);
$result = $webService->receiveDocument($lst);
dd($result);
} catch (Exception $ex) {
echo $exception->getMessage();
}