Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TSoapService

TComponent
   |
   --TApplicationComponent
      |
      --TService
         |
         --TSoapService

TSoapService class

TSoapService processes SOAP requests for a PRADO application. TSoapService requires PHP SOAP extension to be loaded.

TSoapService manages a set of SOAP providers. Each SOAP provider is a class that implements a set of SOAP methods which are exposed to SOAP clients for remote invocation. TSoapService generates WSDL automatically for the SOAP providers by default.

To use TSoapService, configure it in the application specification like following:

  1. <services>
  2. <service id="soap" class="System.Web.Services.TSoapService">
  3. <soap id="stockquote" provider="MyStockQuote" />
  4. </service>
  5. </services>

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:

  1. http://hostname/path/to/index.php?soap=stockquote.wsdl

The WSDL for the provider class "MyStockQuote" is generated based on special comment tags in the class. In particular, if a class method's comment contains the keyword "@soapmethod", it is considered to be a SOAP method and will be exposed to SOAP clients. For example,

  1. class MyStockQuote {
  2. / **
  3. * @param string $symbol the stock symbol
  4. * @return float the stock price
  5. * @soapmethod
  6. * /
  7. public function getQuote($symbol) {...}
  8. }

With the above SOAP provider, a typical SOAP client may call the method "getQuote" remotely like the following:

  1. $client=new SoapClient("http://hostname/path/to/index.php?soap=stockquote.wsdl");
  2. echo $client->getQuote("ibm");

Each <soap> element in the application specification actually configures the properties of a SOAP server which defaults to TSoapServer. Therefore, any writable property of TSoapServer may appear as an attribute in the <soap> element. For example, the "provider" attribute refers to the TSoapServer::setProvider property of TSoapServer. The following configuration specifies that the SOAP server is persistent within the user session (that means a MyStockQuote object will be stored in session)

  1. <services>
  2. <service id="soap" class="System.Web.Services.TSoapService">
  3. <soap id="stockquote" provider="MyStockQuote" SessionPersistent="true" />
  4. </service>
  5. </services>

You may also use your own SOAP server class by specifying the "class" attribute of <soap>.

Since: 3.1
Author: Knut Urdalen <knut.urdalen@gmail.com>
Author: Qiang Xue <qiang.xue@gmail.com>

Constructor Summary
public
Constructor.

Method Summary
string
constructUrl ( string $serverID, array $getParams, boolean $encodeAmpersand, boolean $encodeGetItems)
Constructs a URL with specified page path and GET parameters.
protected  TSoapServer
Creates the requested SOAP server.
string
boolean
string
void
init ( TXmlElement $config)
Initializes this module.
protected  void
Resolves the request parameter.
void
run ()
Runs the service.
void
setConfigFile ( string $value)
Methods Inherited From TService
TService::getEnabled(), TService::getID(), TService::init(), TService::run(), TService::setEnabled(), TService::setID()
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constant Summary
string CONFIG_FILE_EXT
string DEFAULT_SOAP_SERVER

Constructor Details

__construct

public __construct

Constructor.

Sets default service ID to 'soap'.


Method Details

constructUrl

public string constructUrl (string $serverID , array $getParams , boolean $encodeAmpersand , boolean $encodeGetItems )

Constructs a URL with specified page path and GET parameters.

Input
string$serverIDsoap server ID
array$getParamslist of GET parameters, null if no GET parameters required
boolean$encodeAmpersandwhether to encode the ampersand in URL, defaults to true.
boolean$encodeGetItemswhether to encode the GET parameters (their names and values), defaults to true.
Output
string URL for the page and GET parameters
Exception

createServer

protected TSoapServer createServer ()

Creates the requested SOAP server.

The SOAP server is initialized with the property values specified in the configuration.

Output
TSoapServer the SOAP server instance
Exception

getConfigFile

public string getConfigFile ()

Output
string external configuration file. Defaults to null.
Exception

getIsWsdlRequest

public boolean getIsWsdlRequest ()

Output
boolean whether this is a request for WSDL
Exception

getServerID

public string getServerID ()

Output
string the SOAP server ID
Exception

init

public void init (TXmlElement $config )

Initializes this module.

This method is required by the IModule interface.

Input
TXmlElement$configconfiguration for this module, can be null
Output
Exception
throwsTConfigurationException if ConfigFile is invalid.

resolveRequest

protected void resolveRequest ()

Resolves the request parameter.

It identifies the server ID and whether the request is for WSDL.

Output
Exception
throwsTHttpException if the server ID cannot be found

run

public void run ()

Runs the service.

If the service parameter ends with '.wsdl', it will serve a WSDL file for the specified soap server. Otherwise, it will handle the soap request using the specified server.

Output
Exception

setConfigFile

public void setConfigFile (string $value )

Input
string$valueexternal configuration file in namespace format. The file must be suffixed with '.xml'.
Output
Exception
throwsTInvalidDataValueException if the file is invalid.


Constant Details

CONFIG_FILE_EXT

Type:

string

Value:

'.xml'

DEFAULT_SOAP_SERVER

Type:

string

Value:

'TSoapServer'