Class \Prado\Web\Services\TSoapService
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="Prado\Web\Services\TSoapService">
<soap id="stockquote" provider="MyStockQuote" />
</service>
</services>
PHP configuration style:
'services' => array(
'soap' => array(
'class' => 'Prado\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
<services>
<service id="soap" class="Prado\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
Class hierarchy
- \Prado\Web\Services\TSoapService
- \Prado\TService implements IService
- \Prado\TApplicationComponent
- \Prado\TComponent
Author: Qiang Xue <qiang.xue@gmail.com>
Author: Carl G. Mathisen <carlgmathisen@gmail.com>
Since: 3.1
public
|
|
public
|
constructUrl(string $serverID[, array<string|int, mixed> $getParams = null ][, bool $encodeAmpersand = true ][, bool $encodeGetItems = true ]) : string
Constructs a URL with specified page path and GET parameters.
|
public
|
|
public
|
|
public
|
|
public
|
init(TXmlElement $config) : mixed
Initializes this module.
This method is required by the IModule interface. |
public
|
run() : mixed
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. |
public
|
|
protected
|
createServer() : TSoapServer
Creates the requested SOAP server.
The SOAP server is initialized with the property values specified in the configuration. |
protected
|
resolveRequest() : mixed
Resolves the request parameter.
It identifies the server ID and whether the request is for WSDL. |
private
|
public
mixed
|
DEFAULT_SOAP_SERVER
|
\Prado\Web\Services\TSoapServer::class
|
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |