slim xml-rpc

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

slim xml-rpc

Postby pskink » Sun Nov 30, 2008 4:52 pm

hi,

just created ultra slim xml-rpc lib counting three classes.
attached is library + small test app + python test server.py
some parts can be speed optimized, so
please let mknow about your performance feelings.
now it blocks calls to server but i'm workink on async
execution

pskink
Attachments
XMLRPC.tar.gz
v0.2.1 improved exception handling (minimal API change)
(38.57 KiB) Downloaded 323 times
XMLRPC.tar.gz
v0.2 test app updated, javadoc updated
(36.11 KiB) Downloaded 129 times
XMLRPC.tar.gz
v0.1 src + .apk
(26.65 KiB) Downloaded 118 times
Last edited by pskink on Thu Dec 11, 2008 3:08 pm, edited 4 times in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby pskink » Mon Dec 01, 2008 12:56 pm

fyi: added boolean test case
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Tue Dec 02, 2008 3:36 pm

fyi: changed dom parser to pull parser which works better for parsing xmlrpc responses
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Wed Dec 03, 2008 2:19 pm

fyi: added couple of tests. thanks to pull parser the performance and memory usage is better than in previous versions
Last edited by pskink on Sat Dec 06, 2008 8:28 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby Malefico » Wed Dec 03, 2008 5:49 pm

Great..

but what about user authentication and security?
Malefico
Developer
Developer
 
Posts: 30
Joined: Fri Oct 24, 2008 3:32 pm

Postby pskink » Wed Dec 03, 2008 6:26 pm

Malefico wrote:Great..

but what about user authentication and security?


how is it done in xml-rpc? any links?
i thought it's supported by xml-rpc calls themselves (i mean user/hashed pswd/sand are passed as method params)
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Top

Postby eyedol » Thu Dec 04, 2008 10:28 am

Hello pskink,
Thanks for sharing your library. I used your test app against a different and has a different result than I expected. I wonder what I'm doing wrong. This is my code
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ...
  2.  
  3. uri = URI.create("http://data.kamusiproject.org/xmlrpc.php");
  4.  
  5.                 client = new XMLRPCClient(uri);
  6.  
  7. OnItemClickListener testListener = new OnItemClickListener() {
  8.  
  9.                 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  10.  
  11.                         if (position == 0) {
  12.  
  13.                         XMLRPCMethod method = new XMLRPCMethod("get.links", true, new XMLRPCMethodCallback() {
  14.  
  15.                                         public void callFinished(Object result) {
  16.  
  17.                                                
  18.  
  19.                                                 textResult.setText( result.toString() );
  20.  
  21.                                         }
  22.  
  23.                         });
  24.  
  25.                         Object[] params = {
  26.  
  27.                                         "4f087891bc83b087c52e0ddffd732483",
  28.  
  29.                                         "dog",
  30.  
  31.                                         "en",
  32.  
  33.                                         "sw",
  34.  
  35.                         };
  36.  
  37.                         method.call(params);
  38.  
  39.                         }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


this is what is returned. Not sure what that is. Any insight???

{results=[Ljava.lang.Object;@4339de68, paging={items=[Ljava.lang.Object;@433961a0, total=[Ljava.lang.Object;@43395870, array=[Ljava.lang.Object;@43395d08}}
eyedol
Freshman
Freshman
 
Posts: 5
Joined: Mon Nov 26, 2007 2:29 pm

Postby pskink » Thu Dec 04, 2008 11:41 am

eyedol wrote:this is what is returned. Not sure what that is. Any insight???

{results=[Ljava.lang.Object;@4339de68, paging={items=[Ljava.lang.Object;@433961a0, total=[Ljava.lang.Object;@43395870, array=[Ljava.lang.Object;@43395d08}}


hi,

your server returned one struct that can be
casted to java.util.Map<String, Object>.

this map contains two items:
- results - which is Object [] array
- paging - which is another Map<String, Object>

'paging' item contains three items:
- items
- total
- array

all of them are Object[] arrays.

i cannot say what those Object[] arrays contain - it can be primitive types or another containers - you should iterate over them and see what's inside or you could capture the whole http server response - i use for that linux tool ngrep, you can use e.g. ethereal.

hope this helps.
Last edited by pskink on Thu Dec 04, 2008 1:05 pm, edited 1 time in total.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Thu Dec 04, 2008 11:50 am

eyedol wrote:Hello pskink,
Thanks for sharing your library. I used your test app against a different and has a different result than I expected. I wonder what I'm doing wrong.


btw in your real app you shouldn't use XMLRPCMethod - its just for test app purposes - use XMLRPCClient instead.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby eyedol » Thu Dec 04, 2008 10:52 pm

Thanks pslink, I managed to figure out how to get the data with your explanation. Your library rocks :-)
eyedol
Freshman
Freshman
 
Posts: 5
Joined: Mon Nov 26, 2007 2:29 pm

Postby pskink » Thu Dec 04, 2008 11:22 pm

eyedol wrote:Thanks pslink, I managed to figure out how to get the data with your explanation. Your library rocks :-)


i'm glad to hear it.

so now the results you got are the same with your expectation?
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Sat Dec 06, 2008 8:33 pm

fyi: updated test app & javadoc
hope it has its final shape... :D
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby pskink » Thu Dec 11, 2008 3:11 pm

Improved exception handling (minimal API change). Now call* methods throw XMLRPCException/XMLRPCFault instead of Exception.
pskink
pskink
Master Developer
Master Developer
 
Posts: 719
Joined: Mon Nov 24, 2008 3:49 pm

Postby eyedol » Sat Dec 13, 2008 9:05 am

Yes pskink. Thanks for the library
eyedol
Freshman
Freshman
 
Posts: 5
Joined: Mon Nov 26, 2007 2:29 pm

Postby nickthecook » Tue Dec 16, 2008 4:51 am

pskink, this is awesome!

I was getting some exceptions from Apache's XmlRpc implementation on Android, and I feared I wouldn't be able to do what I wanted to. Yet your code worked perfectly (and is also simpler to use for my needs).

When I get something useful written with it, I'll post it. :)

Thank you!
nickthecook
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Dec 16, 2008 4:37 am

Top
Next

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 3 guests