Soap Client __soapCall - silent error

南笙酒味 提交于 2020-04-16 03:58:26

问题


I'm trying to connect to Royal Mail Shipping API and I can't figure it out why on $soapClient->__soapCall($method, $params) the script stops executing. No errors shows on the screen or in logs.

WSDL is pulled from local file and the __getFunctions() returns methods available so I'm assuming this is fine.

Creating soapClient object:

    $soapClientOptions = array(
        'cache_wsdl' => 'WSDL_CACHE_NONE',
        'local_cert' => NULL,
        //'ssl_method' => 'SOAP_SSL_METHOD_SSLv3',
        'location' => $this->apiLocation,
        'stream_context' => stream_context_create($this->getAuthenticationHeaders()),
        'soap_version' => SOAP_1_1,
        'trace' => true,
        'exceptions' => true
    );

    try {
        $soapClient = new SoapClient($this->getStaticEndPoint(), $soapClientOptions);
    } catch(\SoapFault $fault){
        $error      =   "SOAP Fault: (faultcode: {$fault->faultcode}\n" ."faultstring: {$fault->faultstring})"; 
        echo $error;
    }catch(\Exception $exception){
        echo "<BR>".$exception;
    }
    $headerObject = new SoapVar($this->getWsseSecurityHeaders(), XSD_ANYXML);
    $header = new SoapHeader($this->moduleRoot.'/reference/oasis-200401-wss-wssecurity-utility-1.0.xsd', 'Security', $headerObject);
    $soapClient->__setSoapHeaders($header);

Below is the code for __soapCall

    while (true) {
        try {
            $response = $soapClient->__soapCall('createShipment', array());
        } catch (\SoapFault $fault) {
            trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
        } catch (\Exception $e) {
            echo $e->getCode().': '.$e->getMessage();
        }
    }

SoapClient object:

object(SoapClient)#1641 (6) {
  ["location"]=>
  string(37) "https://api.royalmail.net/shipping/v2"
  ["trace"]=>
  int(1)
  ["_stream_context"]=>
  resource(4652) of type (stream-context)
  ["_soap_version"]=>
  int(1)
  ["sdl"]=>
  resource(4653) of type (Unknown)
  ["__default_headers"]=>
  array(1) {
    [0]=>
    object(SoapHeader)#1640 (4) {
      ["namespace"]=>
      string(136) "/RoyalMailShipping/reference/oasis-200401-wss-wssecurity-utility-1.0.xsd"
      ["name"]=>
      string(8) "Security"
      ["data"]=>
      object(SoapVar)#1649 (2) {
        ["enc_type"]=>
        int(147)
        ["enc_value"]=>
        string(820) "

                user@domain.comAPI
                4d+PCTIxEWdlZA2Zr/OkvOXlTv4=
                MTAzMzg5Njc5NA==
                2016-12-13T10:20:46Z

        "
  }
  ["mustUnderstand"]=>
  bool(false)
}

} }

I'm not sure how to debug this as I'm not getting any errors, I have increased php memory_limit but that didn't helped either. I'm using PHP version 5.6.27

来源:https://stackoverflow.com/questions/41119023/soap-client-soapcall-silent-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!