nyx-solutions / yii2-http-soap-client
Yii2 HTTP SOAP 客户端
5.0.0
2022-06-02 14:59 UTC
Requires
- php: >=8.1.0 <8.2
- ext-soap: *
- nyx-solutions/yii2-nyx: ~5.0.0
- nyx-solutions/yii2-nyx-helpers: ~5.0.0
README
Yii2 组件,用于SOAP请求。
安装
安装此扩展的首选方式是通过 Composer。
- 运行以下命令
php composer.phar require --prefer-dist "nyx-solutions/yii2-http-soap-client" "*"
或添加
"nyx-solutions/yii2-http-soap-client": "*"
到您的应用程序的 composer.json 文件的 require 部分。
使用方法
- 在您的应用程序的配置文件中配置
HttpSoapClient组件,例如
'components' => [ 'soapApi' => [ 'class' => 'nyx\http\soap\HttpSoapClient', 'endpoint' => 'http://ws.exemple.com/WebService.asmx?wsdl', 'options' => [ 'cache_wsdl' => WSDL_CACHE_NONE ] ] ]
或者您可以直接在代码中定义 HttpSoapClient
use nyx\http\soap\HttpSoapClient; $client = new HttpSoapClient(['endpoint' => 'http://ws.exemple.com/WebService.asmx?wsdl']);
配置步骤完成后,您可以按如下方式调用SOAP方法(其中 getMessage 是您的SOAP方法)
echo $client->getMessage('Lorem ipsum...');
许可证
yii2-http-soap-client 在BSD 3-Clause许可证下发布。有关详细信息,请参阅附带文件 LICENSE.md。