PHP / Laravel在进行soapcall时似乎没有XML文档

时间:2019-04-01 09:41:45

标签: php laravel soap soapui soap-client

我正在尝试拨打电话,但不断出现以下错误:

  

我们似乎没有XML文档

EDIT错误消息

enter image description here

这是一个在我的SOAP UI中正常工作的示例

enter image description here

这是我发送给soapCall的数组:

$params = [
    'id' => '0000002721',
    'options' => [
                    'returnAttachments' => 'false',
                    'returnPictures'    => 'false',
                    'returnContract'    => 'false'
                 ]
];

这是我如何拨打电话的代码

try {
    $options = array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false,
            'allow_self_signed' => true
        )
    );

    $context = stream_context_create($options);

    $soapClient = new SoapClient(__DIR__ . '/Soap.wsdl', [
        'stream_context' => $context,
        'login' => 'login',
        'password' => 'password',
        'trace' => 1,
            'exceptions' => true,
    ]);

    $soapClient->__setLocation('url');

    $this->soapClient = $soapClient;
} catch (\SoapFault $e) {
    var_dump($e); exit;
}

try {
    $result = $this->soapClient->__soapCall('getMaintenanceObject', $params);
} catch (\SoapFault $e) {
    var_dump($e); exit;
}

1 个答案:

答案 0 :(得分:0)

在显示错误时,SoapClient的表达可能不是很好,请添加以下内容:

var_dump($this->soapClient->__getLastRequestHeaders()); var_dump($this->soapClient->__getLastResponseHeaders());