PRADO Component Framework for PHP 5
  • Home
  • About
  • Testimonials
  • Demos
  • Download
  • Documentation
  • Forum
  • Development
  • Tutorials
  • Class Docs
  • API Manual
  • Wiki

Packages

  • None
  • System
    • Caching
    • Collections
    • Data
      • ActiveRecord
        • Relations
        • Scaffold
          • InputBuilder
      • Commom
        • Sqlite
      • Common
        • Mssql
        • Mysql
        • Oracle
        • Pgsql
        • Sqlite
      • DataGateway
      • SqlMap
        • Configuration
        • Statements
    • Exceptions
    • I18N
    • IO
    • Security
    • Util
    • Web
      • Javascripts
      • Services
      • UI
        • ActiveControls
        • WebControls
    • Xml
  • Wsat
    • pages
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class 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:

<services>
  <service id="soap" class="System.Web.Services.TSoapService">
    <soap id="stockquote" provider="MyStockQuote" />
  </service>
</services>

PHP configuration style:

'services' => array(
  'soap' => array(
   'class' => 'System.Web.Services.TSoapService'
   'properties' => array(
     'provider' => 'MyStockQuote'
  )
  )
)

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,

class MyStockQuote {
   / **
    * @param string $symbol the stock symbol
    * @return float the stock price
    * @soapmethod
    * /
   public function getQuote($symbol) {...}
}

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

$client=new SoapClient("http://hostname/path/to/index.php?soap=stockquote.wsdl");
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 Provider 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)

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

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

TComponent
Extended by TApplicationComponent
Extended by TService implements IService
Extended by TSoapService
Package: System\Web\Services
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Knut Urdalen <knut.urdalen@gmail.com>
Author: Qiang Xue <qiang.xue@gmail.com>
Author: Carl G. Mathisen <carlgmathisen@gmail.com>
Since: 3.1
Located at Web/Services/TSoapService.php
Methods summary
public
# __construct( )

Constructor. Sets default service ID to 'soap'.

Constructor. Sets default service ID to 'soap'.

Overrides

TComponent::__construct()
public
# init( TXmlElement $config )

Initializes this module. This method is required by the IModule interface.

Initializes this module. This method is required by the IModule interface.

Parameters

$config
TXmlElement
configuration for this module, can be null

Throws

TConfigurationException
if getConfigFile ConfigFile is invalid.

Overrides

TService::init()
protected
# resolveRequest( )

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

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

Throws

THttpException
if the server ID cannot be found

See

TSoapService::getServerID()
TSoapService::getIsWsdlRequest()
public string
# getConfigFile( )

Returns

string
external configuration file. Defaults to null.
public
# setConfigFile( string $value )

Parameters

$value
string
external configuration file in namespace format. The file must be suffixed with '.xml'.

Throws

TInvalidDataValueException
if the file is invalid.
public string
# constructUrl( string $serverID, array $getParams = null, boolean $encodeAmpersand = true, boolean $encodeGetItems = true )

Constructs a URL with specified page path and GET parameters.

Constructs a URL with specified page path and GET parameters.

Parameters

$serverID
string
soap server ID
$getParams
array
list of GET parameters, null if no GET parameters required
$encodeAmpersand
boolean
whether to encode the ampersand in URL, defaults to true.
$encodeGetItems
boolean
whether to encode the GET parameters (their names and values), defaults to true.

Returns

string
URL for the page and GET parameters
public boolean
# getIsWsdlRequest( )

Returns

boolean
whether this is a request for WSDL
public string
# getServerID( )

Returns

string
the SOAP server ID
protected TSoapServer
# createServer( )

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

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

Returns

TSoapServer
the SOAP server instance
public
# 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.

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.

Overrides

TService::run()
Methods inherited from TService
getEnabled(), getID(), setEnabled(), setID()
Methods inherited from TApplicationComponent
getApplication(), getRequest(), getResponse(), getService(), getSession(), getUser(), publishAsset(), publishFilePath()
Methods inherited from TComponent
__call(), __destruct(), __get(), __isset(), __set(), __sleep(), __unset(), __wakeup(), addParsedObject(), asa(), attachBehavior(), attachBehaviors(), attachClassBehavior(), attachEventHandler(), canGetProperty(), canSetProperty(), clearBehaviors(), createdOnTemplate(), detachBehavior(), detachBehaviors(), detachClassBehavior(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), evaluateStatements(), fxAttachClassBehavior(), fxDetachClassBehavior(), getAutoGlobalListen(), getBehaviorsEnabled(), getClassHierarchy(), getEventHandlers(), getListeningToGlobalEvents(), getSubProperty(), hasEvent(), hasEventHandler(), hasProperty(), isa(), listen(), raiseEvent(), setSubProperty(), unlisten()
Constants summary
string DEFAULT_SOAP_SERVER 'TSoapServer'
#
Constants inherited from TComponent
GLOBAL_RAISE_EVENT_LISTENER
Terms of Service | Contact Us
PRADO v3.2.4 API Manual API documentation generated by ApiGen 2.8.0
Copyright © 2006-2014 by the PRADO Group.
Powered by PRADO