PHP SOAP连接

时间:2019-03-20 08:54:11

标签: php soap

您好,如果某人对https://github.com/phpro/soap-client/blob/master/docs/middlewares.md#wssemiddleware有问题,因为我的中间件未应用,因此我无法向服务器进行身份验证,并且总是在有/没有中间件的情况下得到错误SSL certificate problem: certificate has expired

<?php
declare(strict_types=1);

namespace App\Soap;

use Http\Adapter\Guzzle6\Client;
use Phpro\SoapClient\Middleware\WsseMiddleware;
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapEngineFactory;
use Phpro\SoapClient\Soap\Driver\ExtSoap\ExtSoapOptions;
use Phpro\SoapClient\Soap\Handler\HttPlugHandle;
use Symfony\Component\EventDispatcher\EventDispatcher;

final class FPClientFactory
{

    public static function factory(string $wsdl): FPClient
    {

        $handler = HttPlugHandle::createForClient(
            Client::createWithConfig([
            ])
        );
        $midd = new WsseMiddleware(
            __DIR__ . '/../path_to.pkey',
            __DIR__ . '/../public.pub'
        );
        $midd->withTimestamp(30000);
        $handler->addMiddleware($midd);

        $engine = ExtSoapEngineFactory::fromOptionsWithHandler(
            ExtSoapOptions::defaults($wsdl, [
            ]),
            $handler
        );

        $eventDispatcher = new EventDispatcher();

        return new FPClient($engine, $eventDispatcher);
    }
}

在那之后,使用客户端我调用了一些方法,但随后出现错误。那么有人知道为什么不应用中间件吗?

0 个答案:

没有答案