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 2007/02/11 22:41:07 UTC
svn commit: r506143 - /webservices/xmlrpc/trunk/src/site/fml/faq.fml
Author: jochen
Date: Sun Feb 11 13:41:06 2007
New Revision: 506143
URL: http://svn.apache.org/viewvc?view=rev&rev=506143
Log:
Documented how to use arrays. (XMLRPC-129)
Modified:
webservices/xmlrpc/trunk/src/site/fml/faq.fml
Modified: webservices/xmlrpc/trunk/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/webservices/xmlrpc/trunk/src/site/fml/faq.fml?view=diff&rev=506143&r1=506142&r2=506143
==============================================================================
--- webservices/xmlrpc/trunk/src/site/fml/faq.fml (original)
+++ webservices/xmlrpc/trunk/src/site/fml/faq.fml Sun Feb 11 13:41:06 2007
@@ -1,5 +1,28 @@
<faqs title="FAQ">
<part id="client">
+ <faq id="arrays">
+ <question>Why do I receive a ClassCastException, if the server returns an array?</question>
+ <answer>
+ <p>The problem is typically caused by code like the following:</p>
+ <source><![CDATA[
+ Integer[] result = (Integer[])server.execute("Server.foo", param);
+ ]]></source>
+ <p>The problem is in the fact, that the XML-RPC response tells
+ the client, that the server returns an array. It doesn't tell
+ what type the array has. In other words, the client will
+ always receive an object array. The workaround is to use
+ code like the following:</p>
+ <source><![CDATA[
+ Object[] result = (Integer[])server.execute("Server.foo", param);
+ for (int i = 0; i < result.length; i++) {
+ Integer num = (Integer) result[i];
+ ...
+ }
+ ]]></source>
+
+ </answer>
+ </faq>
+
<faq id="compression_request">
<question>How do I enable request compression?</question>
<answer>