1
I need to consume a wsdl but the XML for sending to the webservice server has attributes. I created an array containing all tags, but I was wondering how to add the attributes of each tag.
XML to be sent to the server:
<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>";
My 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();
        }
using Curl is no less difficult? which return you will receive?
– Wees Smith