Laravel项目中的SOAP模块问题


SOAP module in Laravel project issue

我正在尝试在Laravel项目上实现消费wsdl

我正在尝试使用这个- Laravel SoapClient Wrapper

但是我对这个有一个问题

// Add a new service to the wrapper
    SoapWrapper::add(function ($service) {
        $service
            ->name('getSessionKey')
            ->wsdl('somelink?wsdl');
            //->trace(true);                                                    // Optional: (parameter: true/false)
            //->header()                                                      // Optional: (parameters: $namespace,$name,$data,$mustunderstand,$actor)
            //->customHeader($customHeader)                                   // Optional: (parameters: $customerHeader) Use this to add a custom SoapHeader or extended class
            //->cookie()                                                      // Optional: (parameters: $name,$value)
            //->location()                                                    // Optional: (parameter: $location)
            //->certificate()                                                 // Optional: (parameter: $certLocation)
            //->cache(WSDL_CACHE_NONE)                                        // Optional: Set the WSDL cache
            //->options(['UserLogin' => 'username', 'Password' => 'password']);   // Optional: Set some extra options
    });
    $createSession = [
        'UserLogin' => 'Thelogin',
        'Password'   => 'Thepassword',
    ];
    // Using the added service
    SoapWrapper::service('CreateSession', function ($service) use ($createSession) {
        var_dump($service->call('CreateSession', [$createSession])->SessionCreate);
    });

我试图调用的web服务被称为'createSession',是头少,接收用户名和密码,并返回会话密钥

我的问题是:为什么这不起作用?我得到错误
SOAP-ERROR: Parsing WSDL: Couldn't load from 'thelink' : failed to load external entity "thelink"

怎么了?这是如何工作的呢?

在您的soapwrapper中命名您的服务

服务->名称(getSessionKey)

,但当你使用它时,你指的是

SoapWrapper::服务("CreateSession",

  1. 将您的服务重命名为CreateSession,如下所示

    服务->名称(CreateSession)

  • 将调用重命名为getSessionKey
  • SoapWrapper::服务("getSessionKey",