<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Obtain a proxy for a service</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sca.createdataobject.html">SCA::createDataObject</a></div> <div class="next" style="text-align: right; float: right;"><a href="sca-localproxy.createdataobject.html">SCA_LocalProxy::createDataObject</a></div> <div class="up"><a href="ref.sca.html">SCA Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="sca.getservice" class="refentry"> <div class="refnamediv"> <h1 class="refname">SCA::getService</h1> <p class="verinfo">(PECL SDO >= 0.5.0)</p><p class="refpurpose"><span class="refname">SCA::getService</span> — <span class="dc-title"> Obtain a proxy for a service </span></p> </div> <div class="refsect1 description" id="refsect1-sca.getservice-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>SCA::getService</strong></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$target</code> </span> [, <span class="methodparam"> <span class="type">string</span> <code class="parameter">$binding</code> </span> [, <span class="methodparam"> <span class="type">array</span> <code class="parameter">$config</code> </span> ]] )</div> <div class="warning"><strong class="warning">Warning</strong><p class="simpara">This function is <em class="emphasis">EXPERIMENTAL</em>. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk. </p></div> <p class="para"> Examine the target and initialize and return a proxy of the appropriate sort. If the target is for a local PHP component the returned proxy will be an SCA_LocalProxy. If the target is for a WSDL file, the returned proxy will be a SCA_SoapProxy.</p> </div> <div class="refsect1 parameters" id="refsect1-sca.getservice-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"> <em><code class="parameter">target</code></em> </span> <dd> <p class="para"> An absolute or relative path to the target service or service description (e.g. a URL to a json-rpc service description, a PHP component, a WSDL file, and so on.). A relative path, if specified, is resolved relative to the location of the script issuing the <span class="function"><strong>getService()</strong></span> call, and not against the include_path or current working directory.</p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">binding</code></em> </span> <dd> <p class="para"> The binding (i.e. protocol) to use to communicate with the service (e.g binding.jsonrpc for a json-rpc service). Note, some service types can be deduced from the target parameter (e.g. if the target parameter ends in .wsdl then SCA will assume binding.soap). Any binding which can be specified in an annotation can be specified here. For example 'binding.soap' is equivalent to the '@binding.soap' annotation.</p> </dd> </dt> <dt> <span class="term"> <em><code class="parameter">config</code></em> </span> <dd> <p class="para"> Any additional configuration properties for the binding (e.g. array('location' => 'http://example.org')). Any binding configuration which can be specified in an annotation can be specified here. For example, 'location' is equivalent to the '@location' annotation to configure the location of a target soap service. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-sca.getservice-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The SCA_LocalProxy or SCA_SoapProxy. </p> </div> <div class="refsect1 examples" id="refsect1-sca.getservice-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-5309"> <p><strong>Example #1 An <span class="function"><strong>SCA::getService()</strong></span> example</strong></p> <div class="example-contents"><p> This example shows how to get a proxy to an email soap service described by <var class="filename">EmailService.wsdl</var> and located at <var class="filename">http://example.org</var>. </p></div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #007700">include </span><span style="color: #DD0000">'SCA/SCA.php'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$service </span><span style="color: #007700">= </span><span style="color: #0000BB">SCA</span><span style="color: #007700">::</span><span style="color: #0000BB">getService</span><span style="color: #007700">(</span><span style="color: #DD0000">'EmailService.wsdl'</span><span style="color: #007700">, </span><span style="color: #DD0000">'binding.soap'</span><span style="color: #007700">, array(</span><span style="color: #DD0000">'location' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'http://example.org'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$service</span><span style="color: #007700">-></span><span style="color: #0000BB">send</span><span style="color: #007700">(...);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="sca.createdataobject.html">SCA::createDataObject</a></div> <div class="next" style="text-align: right; float: right;"><a href="sca-localproxy.createdataobject.html">SCA_LocalProxy::createDataObject</a></div> <div class="up"><a href="ref.sca.html">SCA Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>