<?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;
        }
    }
}
