Phpro\SoapClient\Soap\SoapClientFactory::factory PHP Method

factory() public method

public factory ( string $wsdl, array $soapOptions = [] ) : SoapClient
$wsdl string
$soapOptions array
return SoapClient
    public function factory($wsdl, array $soapOptions = [])
    {
        $defaults = ['trace' => true, 'exceptions' => true, 'keep_alive' => true, 'cache_wsdl' => WSDL_CACHE_BOTH, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'classmap' => $this->classMap->toSoapClassMap(), 'typemap' => $this->typeConverters->toSoapTypeMap()];
        $options = array_merge($defaults, $soapOptions);
        return new SoapClient($wsdl, $options);
    }

Usage Example

示例#1
0
 /**
  * @return ClientInterface
  */
 public function build()
 {
     $soapClientFactory = new SoapClientFactory($this->classMaps, $this->converters);
     $soapClient = $soapClientFactory->factory($this->wsdl, $this->soapOptions);
     if ($this->logger) {
         $this->dispatcher->addSubscriber(new LogPlugin($this->logger));
     }
     return $this->clientFactory->factory($soapClient, $this->dispatcher);
 }
SoapClientFactory