Skip to content

Instantly share code, notes, and snippets.

@pepe84
Created July 25, 2011 09:30
Show Gist options
  • Save pepe84/1103822 to your computer and use it in GitHub Desktop.
Save pepe84/1103822 to your computer and use it in GitHub Desktop.
PHP Zend: My SoapClient resource
...
; SOAP configuration
resources.mysoapclient.wsdl = "routetowsdlfile/mysoap.wsdl"
resources.mysoapclient.options.encoding = "UTF-8"
...
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
/**
* Initialize SoapClient
*/
public function _initMySoapClient()
{
$options = $this->getOptions();
// Load SoapClient WSDL file
/** @todo Read file path! **/
$wsdl = $options['resources']['mysoapclient']['wsdl'];
// Load SoapClient options
$options = $options['resources']['mysoapclient']['options'];
return new Zend_Soap_Client($wsdl, $options);
}
}
<?php
class My_Zend_Soap_Client
{
/**
* Constructor
*
* @param string $wsdl
* @param array $options
*/
public function __construct($wsdl = null, $options = null)
{
parent::__construct($wsdl, $options);
// Init custom PHP SoapClient
include_once 'routetolib/MySoapClient.php'
$this->setSoapClient(new MySoapClient($wsdl, $options));
}
/**
* Perform result pre-processing
*
* @param array $arguments
*/
protected function _preProcessResult($result)
{
return utf8_decode($result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment