Houssamby / android-xmlrpc

Automatically exported from code.google.com/p/android-xmlrpc
0 stars 0 forks source link

Support for <nil/> value extension to the XML-RPC spec? #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. See
http://www.blueskyframework.org/framework/running-bluesky-through-web-services
to see what I am trying to connect to.
2. Actual web service is http://blueskyweb.sonomatech.com/xml-rpc.py
3. Pass latitude and longitude, should return a structured result.

What is the expected output? What do you see instead?
java.io.IOException: Cannot deserialize nil

What version of the product are you using? On what operating system?
Android 2.0

Please provide any additional information below.
I a a beginner and really don't know what I'm doing, so I'm really just
interested in knowing if this is a limitation of android-xmlrpc or
something I'm doing wrong.  I am making the call like this:

XMLRPCClient client = new
XMLRPCClient("http://blueskyweb.sonomatech.com/xml-rpc.py");
HashMap<String, Double> request = new HashMap<String, Double>();
request.put("Latitude", 45.46);
request.put("longitude", -114.961);
String result = "testing...";
try {
    result = (String) client.call("FCCS", request);
} catch (XMLRPCException e) {
    // TODO Auto-generated catch block
    result = e.getMessage();
    e.printStackTrace();
}

Original issue reported on code.google.com by raffscal...@gmail.com on 19 Feb 2010 at 7:30

GoogleCodeExporter commented 9 years ago
hello I'm using this XML-RPC client for android for my thesis. I fixed so it is 
possible to receive null.

added these lines in XMLRPCSerializer.java around line 127.

if (typeNodeName.equals(TYPE_NULL)){
    parser.nextTag();
    obj = null;
} 

added TYPE_NULL = "nil" in IXMLRPCSerializer.java

hope that someone have some use for it.

Original comment by mattias....@gmail.com on 19 Nov 2010 at 2:57

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for this Mattias, I'll look at trying to patch that in at some point 
over the next week or so.

Original comment by jon@sprig.gs on 19 Nov 2010 at 4:00

GoogleCodeExporter commented 9 years ago
Perfect! Just went looking for this and it's good to see that it will be 
implemented.

Thanks Mattias and Jon! :)

Original comment by Leige...@gmail.com on 22 Nov 2010 at 8:12

GoogleCodeExporter commented 9 years ago
Great, thanks!

Original comment by raffscal...@gmail.com on 22 Nov 2010 at 8:00

GoogleCodeExporter commented 9 years ago
I added support for send null as well.
added these lines around line 29.
if (object == null){
     serializer.startTag(null, TYPE_NULL).endTag(null, TYPE_NULL);
}
I hope that it works well.

Thanks for a great library.

Original comment by mattias....@gmail.com on 23 Nov 2010 at 7:42

Attachments:

GoogleCodeExporter commented 9 years ago
Hi mattias.ellback, thanks for these great fixes. I'm just adding them into the 
code now, ready for pushing.

Would it be possible, in the future, to supply patches rather than complete 
files? These can be created at the command line, by typing svn diff, or your 
IDE may supply some route to create patches. It simply makes it easier to see 
what the changes are you're introducing, although, to be fair, you also 
document them in the comments, but it would save repeating them twice :)

These patches are a real boon to anyone using this library. Top marks!

Original comment by jon@sprig.gs on 23 Nov 2010 at 9:39

GoogleCodeExporter commented 9 years ago
Yes, the XML-RPC API I wish to connect to uses <nil/> so much that it's 
*almost* useless to connect to it unless it is supported :) Thanks for taking 
the time to add this into the official release Jon.

Original comment by Leige...@gmail.com on 23 Nov 2010 at 11:53

GoogleCodeExporter commented 9 years ago
It's in the repo now. Any chance someone can test it? (My XMLRPC service is 
currently down, and I don't know when I'll have the chance to fix it any time 
soon...)

Thanks!

Original comment by jon@sprig.gs on 24 Nov 2010 at 9:45

GoogleCodeExporter commented 9 years ago
I've just compiled the app and confirmed it compiles and runs properly at least 
(with the test app and server in the repo), but, to confirm, I still need to 
know whether this resolves the initially raised issue.

Original comment by jon@sprig.gs on 24 Nov 2010 at 7:57

GoogleCodeExporter commented 9 years ago
Sorry, I won't be able to test it until this Saturday.

Original comment by Leige...@gmail.com on 25 Nov 2010 at 4:11

GoogleCodeExporter commented 9 years ago
Sorry about taking so long to get back to you, but I tested this about a month 
ago and everything seemed to work correctly, so I believe </nil> is now 
supported correctly.

Cheers,
Shane

Original comment by Leige...@gmail.com on 2 Aug 2011 at 4:00

GoogleCodeExporter commented 9 years ago

Original comment by jon@sprig.gs on 2 Aug 2011 at 5:23

GoogleCodeExporter commented 9 years ago
Indeed.  It does work now.  Thanks.

Original comment by raffscal...@gmail.com on 2 Aug 2011 at 3:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Had similar problem with value ex:nil, resolved by adding 

String TYPE_NULL2 = "ex:nil";

to file

IXMLRPCSerializer.java 

and modifying above code to

if (typeNodeName.equals(TYPE_NULL) || typeNodeName.equals(TYPE_NULL2)) {

Original comment by sidzan...@gmail.com on 3 Oct 2011 at 1:03

GoogleCodeExporter commented 9 years ago
Hi, 

i had also a problem with support of two data types you use:

Apache says that "nil" and "i8" are extension data types: 
http://ws.apache.org/xmlrpc/types.html
Those types are always used with namespace "ex", which refers to the namespace 
URI "http://ws.apache.org/xmlrpc/namespaces/extensions". So I'm wondering how 
this "nil" works for you, as the specification says that it needs this "ex" 
prefix (same with "i8").

Therefore, I made two changes:

1) added "ex:" before the type constants in IXMLRPCSerializer: 

String TYPE_I8 = "ex:i8";
String TYPE_NULL = "ex:nil";

2) added the namespace to the generated request XML in XMLRPCClient in method 
"methodCall" after line "serializer.startDocument(null, null);":

serializer.setPrefix("ex", "http://ws.apache.org/xmlrpc/namespaces/extensions");

This works fine for me. Maybe there would be an easier solution for this as you 
obviously have no problems in this area, but I wasn't able to figure out 
anything else.

Thanks.
Reinhard Freiler

Original comment by reinhard...@gmail.com on 13 Jan 2013 at 2:19