michalkortas/webservicentlm
最新稳定版本:1.0.0
Composer 安装命令:
composer require michalkortas/webservicentlm
包简介
Override default SoapClient class to connect webservice with NTLM Windows authentication
README 文档
README
Override default SoapClient class to connect webservice with NTLM Windows authentication
Licence
MIT
Installation via Composer
composer require michalkortas/webservicentlm
Laravel 5.5 and earlier
Register new ServiceProvider in config/app.php
michalkortas\WebserviceNtlm\WebserviceNtlmProvider::class
Register new Alias in config/app.php
'NtlmSoapService' => michalkortas\WebserviceNtlm\Services\NtlmSoapService::class
Usage
Set credentials
Just add to your .enf file:
NTLM_DOMAIN="domain" NTLM_USER="user" NTLM_PASSWORD="password"
Init connection
$client = NtlmSoapService::initClient('https://your_webservice_url'); $data = $client->webserviceMethod();
Change connection
Package use config/ntlmsoapservice.php file to set domain\user credential. If you want to connect to other webservices with other credentials, set new credential type in this file, e.g.:
return [ 'default' => [ 'domain' => env('NTLM_DOMAIN', 'domain'), 'user' => env('NTLM_USER', 'user'), 'password' => env('NTLM_PASSWORD', 'password'), ], 'other_credentials' => [ 'domain' => 'domain2', 'user' => 'user2', 'password' => 'user3', ], ];
Add credential name as second initClient() param:
$client = NtlmSoapService::initClient('https://other_webservice_url', 'other_credentials'); $data = $client->webserviceMethod();
Headers
If you want add some headers to connection, just type:
$client = NtlmSoapService::initClient('https://your_webservice_url'); $header = new \SoapHeader( 'http://schemas.xmlsoap.org/soap/envelope/', 'Header'); $client->__setSoapHeaders($header); $data = $client->webserviceMethod();
Get last request
If you want to show last request (e.g. send XML), check __getLastRequest() method:
$client = NtlmSoapService::initClient('https://your_webservice_url'); $header = new \SoapHeader( 'http://schemas.xmlsoap.org/soap/envelope/', 'Header'); $client->__setSoapHeaders($header); $data = $client->webserviceMethod(); var_dump($client->__getLastRequest());
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-02