summaryrefslogtreecommitdiff
path: root/framework/Web/Services/TSoapService.php
diff options
context:
space:
mode:
authorChristophe.Boulain <>2009-05-27 13:55:58 +0000
committerChristophe.Boulain <>2009-05-27 13:55:58 +0000
commit7d15c048340cbcbd06cb9664b479d45906d2b0d8 (patch)
tree0af02875479def0e52d5ea1b6d11b5a276a477a6 /framework/Web/Services/TSoapService.php
parent5a87ceb5ce3a62aae92c344f670059971d5914d9 (diff)
parent9a87732ce51fd34e312ac63ed1ebec8d7fc1c16f (diff)
Merge from 3.2 branch.
Beginning of Prado 3.2 development
Diffstat (limited to 'framework/Web/Services/TSoapService.php')
-rw-r--r--framework/Web/Services/TSoapService.php61
1 files changed, 43 insertions, 18 deletions
diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php
index d943d6fb..ddb5cecb 100644
--- a/framework/Web/Services/TSoapService.php
+++ b/framework/Web/Services/TSoapService.php
@@ -30,12 +30,16 @@
* </service>
* </services>
* </code>
- *
- * The above example specifies a single SOAP provider named "stockquote"
- * whose class is "MyStockQuote". A SOAP client can then obtain the WSDL for
- * this provider via the following URL:
+ * PHP configuration style:
* <code>
- * http://hostname/path/to/index.php?soap=stockquote.wsdl
+ * 'services' => array(
+ * 'soap' => array(
+ * 'class' => 'System.Web.Services.TSoapService'
+ * 'properties' => array(
+ * 'provider' => 'MyStockQuote'
+ * )
+ * )
+ * )
* </code>
*
* The WSDL for the provider class "MyStockQuote" is generated based on special
@@ -79,13 +83,13 @@
*
* @author Knut Urdalen <knut.urdalen@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
+ * @author Carl G. Mathisen <carlgmathisen@gmail.com>
* @package System.Web.Services
* @since 3.1
*/
class TSoapService extends TService
{
const DEFAULT_SOAP_SERVER='TSoapServer';
- const CONFIG_FILE_EXT='.xml';
private $_servers=array();
private $_configFile=null;
private $_wsdlRequest=false;
@@ -148,19 +152,35 @@ class TSoapService extends TService
/**
* Loads configuration from an XML element
- * @param TXmlElement configuration node
+ * @param mixed configuration node
* @throws TConfigurationException if soap server id is not specified or duplicated
*/
- private function loadConfig($xml)
- {
- foreach($xml->getElementsByTagName('soap') as $serverXML)
+ private function loadConfig($config)
+ {
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP)
{
- $properties=$serverXML->getAttributes();
- if(($id=$properties->remove('id'))===null)
- throw new TConfigurationException('soapservice_serverid_required');
- if(isset($this->_servers[$id]))
- throw new TConfigurationException('soapservice_serverid_duplicated',$id);
- $this->_servers[$id]=$properties;
+ if(is_array($config))
+ {
+ foreach($config['soap'] as $id => $server)
+ {
+ $properties = isset($server['properties'])?$server['properties']:array();
+ if(isset($this->_servers[$id]))
+ throw new TConfigurationException('soapservice_serverid_duplicated',$id);
+ $this->_servers[$id]=$properties;
+ }
+ }
+ }
+ else
+ {
+ foreach($config->getElementsByTagName('soap') as $serverXML)
+ {
+ $properties=$serverXML->getAttributes();
+ if(($id=$properties->remove('id'))===null)
+ throw new TConfigurationException('soapservice_serverid_required');
+ if(isset($this->_servers[$id]))
+ throw new TConfigurationException('soapservice_serverid_duplicated',$id);
+ $this->_servers[$id]=$properties;
+ }
}
}
@@ -179,7 +199,7 @@ class TSoapService extends TService
*/
public function setConfigFile($value)
{
- if(($this->_configFile=Prado::getPathOfNamespace($value,self::CONFIG_FILE_EXT))===null)
+ if(($this->_configFile=Prado::getPathOfNamespace($value,Prado::getApplication()->getConfigurationFileExt()))===null)
throw new TConfigurationException('soapservice_configfile_invalid',$value);
}
@@ -221,7 +241,12 @@ class TSoapService extends TService
protected function createServer()
{
$properties=$this->_servers[$this->_serverID];
- if(($serverClass=$properties->remove('class'))===null)
+ $serverClass=null;
+ if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP && isset($config['class']))
+ $serverClass=$config['class'];
+ else if($this->getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_XML)
+ $serverClass=$properties->remove('class');
+ if($serverClass===null)
$serverClass=self::DEFAULT_SOAP_SERVER;
Prado::using($serverClass);
$className=($pos=strrpos($serverClass,'.'))!==false?substr($serverClass,$pos+1):$serverClass;