You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-auto@ws.apache.org by jo...@apache.org on 2009/10/13 23:57:24 UTC
svn commit: r824945 - /webservices/xmlrpc/site/faq.html
Author: jochen
Date: Tue Oct 13 21:57:24 2009
New Revision: 824945
URL: http://svn.apache.org/viewvc?rev=824945&view=rev
Log: (empty)
Modified:
webservices/xmlrpc/site/faq.html
Modified: webservices/xmlrpc/site/faq.html
URL: http://svn.apache.org/viewvc/webservices/xmlrpc/site/faq.html?rev=824945&r1=824944&r2=824945&view=diff
==============================================================================
--- webservices/xmlrpc/site/faq.html (original)
+++ webservices/xmlrpc/site/faq.html Tue Oct 13 21:57:24 2009
@@ -42,7 +42,7 @@
<div class="xleft">
- Last Published: 2008-11-28
+ Last Published: 2009-08-14
</div>
<div class="xright"> <a href="http://www.apache.org/" class="externalLink">Apache</a>
|
@@ -80,51 +80,66 @@
</li>
<li class="none">
- <a href="client.html">Client Classes</a>
+ <a href="download.html">Download</a>
</li>
<li class="none">
- <a href="server.html">Server Side XML-RPC</a>
+ <a href="changes-report.html">Changes</a>
</li>
<li class="none">
- <a href="extensions.html">Vendor Extensions</a>
+ <a href="mail-lists.html">Mailing Lists</a>
</li>
<li class="none">
- <a href="ssl.html">SSL</a>
+ <a href="contributing.html">Contributing</a>
</li>
<li class="none">
- <a href="introspection.html">Introspection</a>
+ <a href="xmlrpc2">XML-RPC 2</a>
</li>
<li class="none">
- <a href="advanced.html">Advanced Techniques</a>
+ <a href="links.html">Links</a>
</li>
+ </ul>
+ <h5>Documentation</h5>
+ <ul>
<li class="none">
- <a href="types.html">XML-RPC Types</a>
+ <a href="client.html">Client Classes</a>
</li>
<li class="none">
- <a href="download.html">Download</a>
+ <a href="server.html">Server Side XML-RPC</a>
</li>
<li class="none">
- <strong>FAQ</strong>
- </li>
+ <a href="extensions.html">Vendor Extensions</a>
+ </li>
<li class="none">
- <a href="contributing.html">Contributing</a>
+ <a href="ssl.html">SSL</a>
</li>
<li class="none">
- <a href="xmlrpc2">XML-RPC 2</a>
+ <a href="introspection.html">Introspection</a>
</li>
<li class="none">
- <a href="links.html">Links</a>
+ <a href="advanced.html">Advanced Techniques</a>
+ </li>
+
+ <li class="none">
+ <a href="types.html">XML-RPC Types</a>
+ </li>
+
+ <li class="none">
+ <strong>FAQ</strong>
+ </li>
+
+ <li class="none">
+ <a href="apidocs/index.html">Javadocs</a>
</li>
</ul>
<h5>Project Documentation</h5>
@@ -187,49 +202,38 @@
</div>
<div id="bodyColumn">
<div id="contentBox">
- <div class="section"><h2><a name="top">FAQ</a>
-</h2>
-<ol type="1"><li><a href="#arrays">Why do I receive a ClassCastException, if the server returns an array?</a>
-</li>
-<li><a href="#compression_request">How do I enable request compression?</a>
-</li>
-<li><a href="#compression_response">How do I enable response compression?</a>
-</li>
+ <div class="section"><h2><a name="top">FAQ</a></h2>
+<ol type="1"><li><a href="#arrays">Why do I receive a ClassCastException, if the server returns an array?</a></li>
+<li><a href="#compression_request">How do I enable request compression?</a></li>
+<li><a href="#compression_response">How do I enable response compression?</a></li>
<li><a href="#timeout_callback">Is it possible to specify a timeout, after which the
- client stops waiting for the servers response?</a>
-</li>
+ client stops waiting for the servers response?</a></li>
+<li><a href="#string_format">Apache XML-RPC is sending strings as
+ <value>SomeString</value>. Whereas I would expect
+ <value><string>SomeString</string></value>.
+ </a></li>
<li><a href="#nonstandard_date_format">I've got a server, which is expecting a non-standard
date format. How can I ensure, that my date values have the
- right format?</a>
-</li>
+ right format?</a></li>
<li><a href="#nonstandard_double_format">I've got a server, which is expecting a non-standard
double format. How can I ensure, that my double values have the
- right format?</a>
-</li>
+ right format?</a></li>
<li><a href="#java_version">I am using Java 1.4 (or Java 1.5, or later). Can I use
- javax.net.ssl.SSLSocketFactory? (Or the java.net.Proxy?)</a>
-</li>
+ javax.net.ssl.SSLSocketFactory? (Or the java.net.Proxy?)</a></li>
</ol>
-<ol type="1"><li><a href="#logging">How do I reduce the servers error logging?</a>
-</li>
-<li><a href="#streaming_mode">How do I enable streaming mode?</a>
-</li>
-<li><a href="#basic_authentication">How do I configure the server for basic authentication?</a>
-</li>
-<li><a href="#handler_initialization">How do I initalize the request processors?</a>
-</li>
-<li><a href="#client_ip">How to I get the clients IP address in a handler?</a>
-</li>
-<li><a href="#client_ip_webserver">How to I get the clients IP address in a handler when using the WebServer class?</a>
-</li>
+<ol type="1"><li><a href="#logging">How do I reduce the servers error logging?</a></li>
+<li><a href="#streaming_mode">How do I enable streaming mode?</a></li>
+<li><a href="#basic_authentication">How do I configure the server for basic authentication?</a></li>
+<li><a href="#handler_initialization">How do I initalize the request processors?</a></li>
+<li><a href="#client_ip">How to I get the clients IP address in a handler?</a></li>
+<li><a href="#client_ip_webserver">How to I get the clients IP address in a handler when using the WebServer class?</a></li>
</ol>
</div>
-<dl><dt><a name="arrays">Why do I receive a ClassCastException, if the server returns an array?</a>
-</dt>
+<dl><dt><a name="arrays">Why do I receive a ClassCastException, if the server returns an array?</a></dt>
<dd>
<p>The problem is typically caused by code like the following:</p>
<div class="source"><pre>
- Integer[] result = (Integer[])server.execute("Server.foo", param);
+ Integer[] result = server.execute("Server.foo", param);
</pre>
</div>
@@ -248,11 +252,9 @@
</div>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="compression_request">How do I enable request compression?</a>
-</dt>
+<dt><a name="compression_request">How do I enable request compression?</a></dt>
<dd>
<p>That's simple: Set the properties "enabledForExtensions"
and "gzipCompressing". That said, note the following
@@ -274,11 +276,9 @@
depends on HTTP/1.1 features. In particular, you must
not use the LiteHttpTransport.</li>
</ul>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="compression_response">How do I enable response compression?</a>
-</dt>
+<dt><a name="compression_response">How do I enable response compression?</a></dt>
<dd>
<p>That's as simple as enabling request compression: Set the
properties "enabledForExtensions" and "gzipRequesting".
@@ -294,12 +294,10 @@
depends on HTTP/1.1 features. In particular, you must
not use the LiteHttpTransport.</li>
</ul>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
<dt><a name="timeout_callback">Is it possible to specify a timeout, after which the
- client stops waiting for the servers response?</a>
-</dt>
+ client stops waiting for the servers response?</a></dt>
<dd>
<p>Yes, use the class TimingOutCallback.</p>
<div class="source"><pre>
@@ -317,34 +315,76 @@
</pre>
</div>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
+</dd>
+<dt><a name="string_format">Apache XML-RPC is sending strings as
+ <value>SomeString</value>. Whereas I would expect
+ <value><string>SomeString</string></value>.
+ </a></dt>
+<dd>
+ <p>Both formats are valid. XML-RPC compliant software (as Apache
+ XML-RPC is) must be able to understand both. Of course, you can
+ only produce one. Unfortunately there are a lot of processors
+ out there, which understand just one. Which is the reason,
+ why this FAQ entry exists.</p>
+ <p>Fortunately, it is not overly difficult to change the format,
+ that Apache XML-RPC produces. First of all, create a custom
+ type factory:</p>
+ <div class="source"><pre>
+ package mypackage;
+
+ import org.apache.xmlrpc.common.TypeFactoryImpl;
+ import org.apache.xmlrpc.common.XmlRpcController;
+ import org.apache.xmlrpc.common.XmlRpcStreamConfig;
+ import org.xml.sax.ContentHandler;
+ import org.xml.sax.SAXException;
+
+ public class MyTypeFactory extends TypeFactoryImpl {
+ private static final TypeSerializer myStringSerializer = new StringSerializer(){
+ public void write(ContentHandler pHandler, Object pObject) throws SAXException {
+ write(pHandler, STRING_TAG, pObject.toString());
+ }
+ };
+
+ public MyTypeFactory(XmlRpcController pController) {
+ super(pController);
+ }
+
+ public TypeSerializer getSerializer(XmlRpcStreamConfig pConfig,
+ Object pObject) throws SAXException {
+ if (pObject instanceof String) {
+ return myStringSerializer;
+ }
+ return super.getSerializer(pConfig, pObject);
+ }
+ }
+ </pre>
+</div>
+
+ <p>Then you'e got to install that custom type factory. This works as
+ described in the <a href="advanced.html">section on "Custom Data Types"</a>.</p>
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
<dt><a name="nonstandard_date_format">I've got a server, which is expecting a non-standard
date format. How can I ensure, that my date values have the
- right format?</a>
-</dt>
+ right format?</a></dt>
<dd>
<p>You've got to use a special type factory. An example is
contained in the documentation on
{{{advanced.html}advanced topics}}.</p>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
<dt><a name="nonstandard_double_format">I've got a server, which is expecting a non-standard
double format. How can I ensure, that my double values have the
- right format?</a>
-</dt>
+ right format?</a></dt>
<dd>
<p>You've got to use a special type factory. An example is
contained in the documentation on
{{{advanced.html}advanced topics}}.</p>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
<dt><a name="java_version">I am using Java 1.4 (or Java 1.5, or later). Can I use
- javax.net.ssl.SSLSocketFactory? (Or the java.net.Proxy?)</a>
-</dt>
+ javax.net.ssl.SSLSocketFactory? (Or the java.net.Proxy?)</a></dt>
<dd>
<p>Yes, you can. Use the org.apache.xmlrpc.client.XmlRpcSun14HttpTransportFactory.
(Or the org.apache.xmlrpc.client.XmlRpcSun15HttpTransportFactory.)</p>
@@ -361,17 +401,13 @@
<p>With the Lite HTTP transport factory, things are slightly different:
You have to explicitly create an instance of XmlRpcLite14HttpTransportFactory.</p>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table></dd>
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table></dd>
</dl>
-<dl><dt><a name="logging">How do I reduce the servers error logging?</a>
-</dt>
+<dl><dt><a name="logging">How do I reduce the servers error logging?</a></dt>
<dd>Create a subclass of XmlRpcErrorLogger and set it on the
- XmlRpcStreamServer.<table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ XmlRpcStreamServer.<table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="streaming_mode">How do I enable streaming mode?</a>
-</dt>
+<dt><a name="streaming_mode">How do I enable streaming mode?</a></dt>
<dd>
<p>Set the property "enabledForExtensions". Note, that enabling
the streaming mode doesn't mean, that all responses are served
@@ -389,19 +425,15 @@
Streaming mode means, in particular, that the response will
not contain a content-length header.</li>
</ul>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="basic_authentication">How do I configure the server for basic authentication?</a>
-</dt>
+<dt><a name="basic_authentication">How do I configure the server for basic authentication?</a></dt>
<dd>
<p>Basically you've got to provide an AuthenticationHandler.
See the {{{server.html}server documentation}} for an example.</p>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="handler_initialization">How do I initalize the request processors?</a>
-</dt>
+<dt><a name="handler_initialization">How do I initalize the request processors?</a></dt>
<dd>
<p>The PropertyHandlerMapping assumes, that request processors are
POJO's (plain old java objects). However, this is not always
@@ -434,11 +466,9 @@
</pre>
</div>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="client_ip">How to I get the clients IP address in a handler?</a>
-</dt>
+<dt><a name="client_ip">How to I get the clients IP address in a handler?</a></dt>
<dd>
<p>That's a similar question than the question on initializing handlers.
The main difference is, that in this case you want to initialize the
@@ -471,15 +501,12 @@
</pre>
</div>
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table><hr />
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table><hr />
</dd>
-<dt><a name="client_ip_webserver">How to I get the clients IP address in a handler when using the WebServer class?</a>
-</dt>
+<dt><a name="client_ip_webserver">How to I get the clients IP address in a handler when using the WebServer class?</a></dt>
<dd>
Use the ServletWebServer class and see the answer to the previous question.
- <table border="0"><tr><td align="right"><a href="#top">[top]</a>
-</td></tr></table></dd>
+ <table border="0"><tr><td align="right"><a href="#top">[top]</a></td></tr></table></dd>
</dl>
</div>
@@ -489,7 +516,7 @@
</div>
<div id="footer">
<div class="xright">©
- 2001-2008
+ 2001-2009
The Apache Software Foundation