sca.examples.calling.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 77 行

HTML
77
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Calling another Service Component</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="SCA.examples.proxies.html">Obtaining a proxy for another Service Component</a></div> <div class="next" style="text-align: right; float: right;"><a href="SCA.examples.nonSCAscript.html">Locating and calling services from a script which is not an   SCA Component</a></div> <div class="up"><a href="sca.examples.html">Examples</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="SCA.examples.calling" class="section">  <h2 class="title"> Calling another Service Component </h2>    <p class="para">   The ConvertedStockQuote example also calls the proxies for   the two components to which it refers.   </p>    <p class="para">   <div class="example">    <p><b>Example #1  Calling services </b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$quote&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">stock_quote</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getQuote</span><span style="color: #007700">(</span><span style="color: #0000BB">$ticker</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$rate&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exchange_rate</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRate</span><span style="color: #007700">(</span><span style="color: #0000BB">$currency</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p>    <p class="para">    The call to the StockQuote service is a call to a local service;   the call to the ExchangeRate service is a call to a remote service.   Note that the way the call is made looks the same regardless of   whether the call is to a local service or a remote one.   </p>  <p class="para">    The proxies which have been injected ensure that the way calls   to components look and behave are the same way regardless of whether   they are to a local or remote service, so that components are not   sensitive to whether a call is to a local or a remote service. For   example, the proxy for a local service takes copies of the arguments   and passes only those copies, to ensure that calls are made to be   pass-by-value, as they would be for a remote call. Also, the proxy   for a remote service takes the arguments from a positional   parameter list and ensures they are packaged properly in a SOAP   request and converted back to a positional parameter list at the far   end.   </p>    <p class="para">    In the example above, the      <var class="varname">$ticker</var> and      <var class="varname">$currency</var> are clearly PHP scalar types.   Components can pass the PHP scalar types string, integer, float and   boolean, but data structures on service calls are always passed as   Service Data Objects (SDOs). A later section describes how a   component can create an SDO to pass on a local or Web service call, or   how a component can create an SDO to return. The PHP SDO project   documentation describes how to work with the SDO APIs (see   <a href="ref.sdo.html" class="link">the SDO pages</a>.   </p>   </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="SCA.examples.proxies.html">Obtaining a proxy for another Service Component</a></div> <div class="next" style="text-align: right; float: right;"><a href="SCA.examples.nonSCAscript.html">Locating and calling services from a script which is not an   SCA Component</a></div> <div class="up"><a href="sca.examples.html">Examples</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?