0

When i make a soapcall in Laravel 5.3:

    $xml = "";
    $xml .='<?xml version="1.0"?>
                <PtRealization xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
        $xml .= $array;

    $xml .= '</PtRealization>';

    $updateClient = new SoapClient($this->updateConnectorWsdl);

    $params = array(
        "token" => $this->TEST_connectorTokenSysteem,
        "connectorType" => "PtRealization",
        "connectorVersion" => "1",
        "dataXml" => $xml

    );

    var_dump($updateClient->__soapCall("Execute", array($params)));

It returns this:

enter image description here

So it returns a general message, but how can i achieve that it returns in json with a status?

Bas
  • 2,330
  • 4
  • 29
  • 68
  • Use try/catch: http://stackoverflow.com/a/12693543/1363190 Soap example: http://php.net/manual/en/class.soapfault.php#97875 – Michael Krikorev Mar 24 '17 at 11:19
  • How do i do that in combination with a $updateClient->__soapCall("Execute", array($params))) ? Thats where is goes wrong. – Bas Mar 24 '17 at 11:59
  • Found the awnser here http://stackoverflow.com/questions/41119023/soap-client-soapcall-silent-error, see awnser. – Bas Mar 24 '17 at 12:16

1 Answers1

0
    try {
        $response = $updateClient->__soapCall("Execute", array($params));
        echo '{ "success:": "Data ingevoerd"}';

    } catch (\SoapFault $fault) {
        echo '{ "error:": "'.$fault->faultstring.'"}';
    }
Bas
  • 2,330
  • 4
  • 29
  • 68