Как подключить веб-сервисы с помощью Laravel And Soap 1.1 - PullRequest
0 голосов
/ 01 ноября 2018

Здравствуйте, мне нужно подключиться к веб-сервисам SOAP для получения данных оттуда. SOAP-запрос:

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetDS4Response xmlns="http://tempuri.org/WAPSWS/WAPSWS">
      <GetDS4Result>
        <xsd:schema>schema</xsd:schema>xml</GetDS4Result>
    </GetDS4Response>
  </soap:Body>
</soap:Envelope>

я пробую этот код, но на блейде ничего не появляется

public function show()
    {
        $source = <<<SOURCE
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetDS4 xmlns="http://tempuri.org/WAPSWS/WAPSWS">
      <CommandString>select top 10 * from applpendingremark</CommandString>
    </GetDS4>
  </soap:Body>
</soap:Envelope>
SOURCE;


$xml = simplexml_load_string($source);
$xml->registerXPathNamespace('tempuri', 'http://moaqs.com/MOAQSWS/WAPSWS.asmx?op=GetDS4');
$elements = $xml->xpath('//soap:Envelope/soap:Body/tempuri:GetDS4/tempuri:GetDS4');
$result = json_encode($elements, true);
print_r($result);



        return view('aa.aa',compact('result'));
    }

заранее спасибо

...