lite.html
来自「perl教程」· HTML 代码 · 共 1,152 行 · 第 1/5 页
HTML
1,152 行
</li>
<li>
<p>Supports UDDI publishing API. Examples and documentation provided.</p>
</li>
<li>
<p>Supports WSDL schema with stub and run-time access.</p>
</li>
<li>
<p>Supports blessed object references.</p>
</li>
<li>
<p>Supports arrays (both serialization and deserialization with autotyping).</p>
</li>
<li>
<p>Supports custom serialization.</p>
</li>
<li>
<p>Provides exception transport with custom exceptions</p>
</li>
<li>
<p>Supports Base64 encoding.</p>
</li>
<li>
<p>Supports XML entity encoding.</p>
</li>
<li>
<p>Supports header attributes.</p>
</li>
<li>
<p>Supports dynamic and static class/method binding.</p>
</li>
<li>
<p>Supports objects-by-reference with simple garbage collection and activation.</p>
</li>
<li>
<p>Provides shell for interactive SOAP sessions.</p>
</li>
<li>
<p>Supports out parameters binding.</p>
</li>
<li>
<p>Supports transparent SOAP calls with autodispatch feature.</p>
</li>
<li>
<p>Provides easy services deployment. Put module in specified directory and
it'll be accessible.</p>
</li>
<li>
<p>Has tests, examples and documentation to let you be up and running in no time.</p>
</li>
</ul>
<p>
</p>
<h2><a name="where_to_find_examples">WHERE TO FIND EXAMPLES</a></h2>
<p>See <em>t/*.t</em>, <em>examples/*.pl</em> and the module documentation for a client-side
examples that demonstrate the serialization of a SOAP request, sending it
via HTTP to the server and receiving the response, and the deserialization
of the response. See <em>examples/server/*</em> for server-side implementations.</p>
<p>
</p>
<hr />
<h1><a name="overview_of_classes_and_packages">OVERVIEW OF CLASSES AND PACKAGES</a></h1>
<p>This table should give you a quick overview of the classes provided by the
library.</p>
<pre>
SOAP::Lite.pm
-- SOAP::Lite -- Main class provides all logic
-- SOAP::Transport -- Supports transport architecture
-- SOAP::Data -- Provides extensions for serialization architecture
-- SOAP::Header -- Provides extensions for header serialization
-- SOAP::Parser -- Parses XML file into object tree
-- SOAP::Serializer -- Serializes data structures to SOAP package
-- SOAP::Deserializer -- Deserializes results of SOAP::Parser into objects
-- SOAP::SOM -- Provides access to deserialized object tree
-- SOAP::Constants -- Provides access to common constants
-- SOAP::Trace -- Provides tracing facilities
-- SOAP::Schema -- Provides access and stub(s) for schema(s)
-- SOAP::Schema::WSDL -- WSDL implementation for SOAP::Schema
-- SOAP::Server -- Handles requests on server side
-- SOAP::Server::Object -- Handles objects-by-reference
-- SOAP::Fault -- Provides support for Faults on server side</pre>
<pre>
SOAP::Transport::HTTP.pm
-- SOAP::Transport::HTTP::Client -- Client interface to HTTP transport
-- SOAP::Transport::HTTP::Server -- Server interface to HTTP transport
-- SOAP::Transport::HTTP::CGI -- CGI implementation of server interface
-- SOAP::Transport::HTTP::Daemon -- Daemon implementation of server interface
-- SOAP::Transport::HTTP::Apache -- mod_perl implementation of server interface</pre>
<pre>
SOAP::Transport::POP3.pm
-- SOAP::Transport::POP3::Server -- Server interface to POP3 protocol</pre>
<pre>
SOAP::Transport::MAILTO.pm
-- SOAP::Transport::MAILTO::Client -- Client interface to SMTP/sendmail</pre>
<pre>
SOAP::Transport::LOCAL.pm
-- SOAP::Transport::LOCAL::Client -- Client interface to local transport</pre>
<pre>
SOAP::Transport::TCP.pm
-- SOAP::Transport::TCP::Server -- Server interface to TCP protocol
-- SOAP::Transport::TCP::Client -- Client interface to TCP protocol</pre>
<pre>
SOAP::Transport::IO.pm
-- SOAP::Transport::IO::Server -- Server interface to IO transport</pre>
<p>
</p>
<h2><a name="soap__lite">SOAP::Lite</a></h2>
<p>All methods that <code>SOAP::Lite</code> provides can be used for both
setting and retrieving values. If you provide no parameters, you will
get current value, and if parameters are provided, a new value
will be assigned to the object and the method in question will return
the current object (if not stated otherwise). This is suitable for stacking
these calls like:</p>
<pre>
<span class="variable">$lite</span> <span class="operator">=</span> <span class="variable">SOAP::Lite</span>
<span class="operator">-></span> <span class="variable">uri</span><span class="operator">(</span><span class="string">'http://simon.fell.com/calc'</span><span class="operator">)</span>
<span class="operator">-></span> <span class="variable">proxy</span><span class="operator">(</span><span class="string">'http://soap.4s4c.com/ssss4c/soap.asp'</span><span class="operator">)</span>
<span class="operator">;</span>
</pre>
<p>The order is insignificant and you may call the <a href="#item_new"><code>new()</code></a> method first. If you
don't do it, SOAP::Lite will do it for you. However, the <a href="#item_new"><code>new()</code></a> method
gives you an additional syntax:</p>
<pre>
<span class="variable">$lite</span> <span class="operator">=</span> <span class="variable">new</span> <span class="variable">SOAP::Lite</span>
<span class="string">uri</span> <span class="operator">=></span> <span class="string">'http://simon.fell.com/calc'</span><span class="operator">,</span>
<span class="string">proxy</span> <span class="operator">=></span> <span class="string">'http://soap.4s4c.com/ssss4c/soap.asp'</span>
<span class="operator">;</span>
</pre>
<dl>
<dt><strong><a name="item_new"><code>new()</code></a></strong>
<dd>
<p><a href="#item_new"><code>new()</code></a> accepts a hash with method names as keys. It will call the
appropriate methods together with the passed values. Since <a href="#item_new"><code>new()</code></a> is
optional it won't be mentioned anymore.</p>
</dd>
</li>
<dt><strong><a name="item_transport"><code>transport()</code></a></strong>
<dd>
<p>Provides access to the <a href="#soap__transport">SOAP::Transport</a> object. The object will be created
for you. You can reassign it (but generally you should not).</p>
</dd>
</li>
<dt><strong><a name="item_serializer"><code>serializer()</code></a></strong>
<dd>
<p>Provides access to the <a href="#soap__serialization">SOAP::Serialization</a> object. The object will be
created for you. You can reassign it (but generally you should not).</p>
</dd>
</li>
<dt><strong><a name="item_proxy"><code>proxy()</code></a></strong>
<dd>
<p>Shortcut for <a href="#item_proxy"><code>transport->proxy()</code></a>. This lets you specify an endpoint
(service address) and also loads the required module at the same time. It is
required for dispatching SOAP calls. The name of the module will be defined
depending on the protocol specific for the endpoint. The prefix
<code>SOAP::Transport</code> will be prepended, the module will be loaded and object of
class (with appended <code>::Client</code>) will be created.</p>
</dd>
<dd>
<p>For example, for <em><a href="http://localhost/">http://localhost/</a></em>, the class for creating objects will
look for <code>SOAP::Transport:HTTP::Client</code>;</p>
</dd>
<dd>
<p>In addition to endpoint parameter, <a href="#item_proxy"><code>proxy()</code></a> can accept any transport specific
parameters that could be passed as name => value pairs. For example, to
specify proxy settings for HTTP protocol you may do:</p>
</dd>
<dd>
<pre>
<span class="variable">$soap</span><span class="operator">-></span><span class="variable">proxy</span><span class="operator">(</span><span class="string">'http://endpoint.server/'</span><span class="operator">,</span>
<span class="string">proxy</span> <span class="operator">=></span> <span class="operator">[</span><span class="string">'http'</span> <span class="operator">=></span> <span class="string">'http://my.proxy.server/'</span><span class="operator">]</span><span class="operator">);</span>
</pre>
</dd>
<dd>
<p>Notice that since proxy (second one) expects to get more than one
parameter you should wrap them in array.</p>
</dd>
<dd>
<p>Another useful example can be the client that is sensitive to cookie-based
authentication. You can provide this with:</p>
</dd>
<dd>
<pre>
<span class="variable">$soap</span><span class="operator">-></span><span class="variable">proxy</span><span class="operator">(</span><span class="string">'http://localhost/'</span><span class="operator">,</span>
<span class="string">cookie_jar</span> <span class="operator">=></span> <span class="variable">HTTP::Cookies</span><span class="operator">-></span><span class="variable">new</span><span class="operator">(</span><span class="string">ignore_discard</span> <span class="operator">=></span> <span class="number">1</span><span class="operator">));</span>
</pre>
</dd>
<dd>
<p>You may specify timeout for HTTP transport with following code:</p>
</dd>
<dd>
<pre>
<span class="variable">$soap</span><span class="operator">-></span><span class="variable">proxy</span><span class="operator">(</span><span class="string">'http://localhost/'</span><span class="operator">,</span> <span class="string">timeout</span> <span class="operator">=></span> <span class="number">5</span><span class="operator">);</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_endpoint"><code>endpoint()</code></a></strong>
<dd>
<p>Lets you specify an endpoint <strong>without</strong> changing/loading the protocol module.
This is useful for switching endpoints without switching protocols. You should
call <a href="#item_proxy"><code>proxy()</code></a> first. No checks for protocol equivalence will be made.</p>
</dd>
</li>
<dt><strong><a name="item_outputxml"><code>outputxml()</code></a></strong>
<dd>
<p>Lets you specify the kind of output from all method calls. If <code>true</code>, all
methods will return unprocessed, raw XML code. You can parse it with
XML::Parser, SOAP::Deserializer or any other appropriate module.</p>
</dd>
</li>
<dt><strong><a name="item_autotype"><code>autotype()</code></a></strong>
<dd>
<p>Shortcut for <a href="#item_autotype"><code>serializer->autotype()</code></a>. This lets you specify whether
the serializer will try to make autotyping for you or not. Default setting
is <code>true</code>.</p>
</dd>
</li>
<dt><strong><a name="item_readable"><code>readable()</code></a></strong>
<dd>
<p>Shortcut for <a href="#item_readable"><code>serializer->readable()</code></a>. This lets you specify the format
for the generated XML code. Carriage returns <CR> and indentation will be
added for readability. Useful in the case you want to see the generated code
in a debugger. By default, there are no additional characters in generated
XML code.</p>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?