You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
601 B
PHP
29 lines
601 B
PHP
<?php
|
|
namespace App\Services;
|
|
|
|
class SoapService
|
|
{
|
|
protected $client;
|
|
|
|
public function __construct($wsdlUrl)
|
|
{
|
|
$options = [
|
|
'trace' => 1,
|
|
'exceptions' => true,
|
|
];
|
|
|
|
$this->client = new SoapClient($wsdlUrl, $options);
|
|
}
|
|
|
|
public function callSoapMethod($methodName, array $params = [])
|
|
{
|
|
try {
|
|
return $this->client->__soapCall($methodName, $params);
|
|
} catch (\SoapFault $e) {
|
|
// 处理错误
|
|
\Log::error('SOAP Fault: ' . $e->getMessage());
|
|
throw $e;
|
|
}
|
|
}
|
|
}
|