Code Monkey home page Code Monkey logo

axmlrpc's People

Contributors

aleinin avatar arturdryomov avatar asellappen avatar chenzhang22 avatar dependabot-preview[bot] avatar dependabot[bot] avatar gturri avatar sebageek avatar simonvt avatar timroes avatar zemanel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

axmlrpc's Issues

<string> content must be escaped

The library simply dumps contents into the content of the xml tag.

However, if said content contains at least < and >, and possibly &, it will confuse all XML-RPC parsers because the output XML for example will become
name
I'm <100% OK

The solution is to escape to HTML codes:
name
I'm <100% OK

Although I agree It's debatable whether the XML-RPC client should do this or something higher up in the client hierarchy, it's easiest fixed in XMLUtil.makeXmlTag:

xml.setContent(content.replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&"));

Serialization Problem

I'm trying to use your library to connect to OpenERP through XML-RPC, but I'm having the hardest time. I've been trying arrays and ArrayLists, but to no avail.

In order to search for information, you have to send over a 2 dimmensional array of search information such as [['name','=','apple'],['shape','=','round'], but every time I ALWAYS get a "No serializer found" exception. This needs to go at the end, like so:

public void search(ArrayList<ArrayList<String>>... values)
    {
        client.callAsync(this, "execute", credentials.getDatabase(), credentials.getUid(), 
                credentials.getPassword(), table, "search", values);
    }

I've already implemented the same application with iOS, and used Python to connect in this manner, so it has to be something in the XML-RPC specification that should let you do thing. Above, as you can see, I saw you can use an ArrayList, but I dont' mind using a 2 dimensional original array.

Any solutions on how to solve this? Thanks.

No serializer found exception, XML escaping.

Hello. I use library for WordPress posting from Android app.
For about last week, i spontanly receiving this from client.call() method. I tried to reproduce bug, but it's realy random, and does not regard to connection speed or parameters in post body.

Can this be explained?

Upd:
This bug is in version 1.7.2.
After reverting to 1.7.0 all seems to be OK.
One more question for versions from 1.7.1 is, that earlier i did String escaping by myself due to necessary tag in post body. Now, after escaping improvement, i cannot correctly transfer tag - on server side i always getting < and > instead. So, i reverting to 1.7.0.

introduce a new DateTimeSerializer

Hi Tim,

According to the XMLRPC Spec the dateTime values should conform to ISO 8601.

Maybe you could create a less strict DateTimeSerializer..!?
The accepted answer from this stackoverflow question hints that you could simply use the data type converter in JAXB (for iso-8601 compliant datetimes: javax.xml.bind.DatatypeConverter.parseDateTime)

What do you think?

Support for self signed certificates

Currently aXMLRPC allows to do certificate checking against either the preinstalled certificate store or to disable checking. In my case my xmlrpcserver is using self signed certificates, so the thing I want to check against is either a certificate fingerprint or a preinstalled root-cacert shipped with the application (depending on the usecase).

I think the easiest way to achieve this is to allow custom certificate managers to be installed in the XMLRPCClient, e.g.

public void installCustomTrustManager(TrustManager tm) {
        trustAllManagers = new TrustManager[] { tm };
}

would allow to set/replace the present trustmanager.

Use VarArgs

Use Vargars (Object...) as parameter for the calls.

Text can be splitted up

XMLUtil.getOnlyTextContent() should also work if the text is splitted up to multiple TextNodes.

Dependency problem

After I cloned the repository in my computer and include the code in my Android app, when I've tried to build the app, Android Studio throws that DateTimeSerializer needs fr.turri.jiso8601.Iso8601Deserializer. I looked for it in gturri gitHob account profile, cloned and include it. It works perfectly, but should advice in the readme or another place. Thanks!

Can't create handler inside thread that has not called Looper.prepare() on showing toast

Thanks for your great library.
I want to make and show toast message in XMLRCPCallBack.onResponse(),
but i'll give fatal exception.

dalvikvm﹕ threadid=12: thread exiting with uncaught exception (group=0x40c8f6d8)
06-13 01:08:54.091    5485-5770/com.example E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-450
    java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
            at android.os.Handler.<init>(Handler.java)
            at android.os.Handler.<init>(Handler.java)
            at android.widget.Toast$TN.<init>(Toast.java)
            at android.widget.Toast.<init>(Toast.java)
            at android.widget.Toast.makeText(Toast.java)
            at com.example.EngineMaster.toast(EngineMaster.java:167)
            at com.example.EngineMaster$1.onResponse(EngineMaster.java:137)
            at de.timroes.axmlrpc.XMLRPCClient$Caller.run(Unknown Source)

Unwanted XML tags added

Some extra tags and are added to a xml request of the type struct. How can I get rid of them? I tried to go through the codes unsuccessfully

False Return value?

This may or may not be a problem with aXMLRPC, but it's hard to say. I wrote 2 apps, one in android and one in iPhone that talk to an XML-RPC server. In a certain situation, when I make a call to the server, it replies with true saying that an action has been done, but on the server, it doesn't seem to register.

The log on the server denotes that there wasn't an error, when in debugging mode, the response from the server is serialized as a boolean of true. Normally, I would blame this on the system, but, like I said, I wrote this exact app on iOS, and we don't have this problem on that program.

I've also gone over my code, and what I do is I try to perform an action, if I get an error back, then I update the record to allow me to perform the action, then I perform the action, again. I examined the call inside of the Android code, and it's EXACTLY the same in both spots, I even tried copying and pasting.

Do you have any insights for me on why I am having this problem?

Thanks, ahead of time.

HTTP authentification

The client is still missing http authentification.

There should be also a flag to handle HTTP 401 not as a broken package, but somehow tell the user authentification is needed.

Error with empty element tag

I send request to server, and check it with Wireshark - the response is coming good. But, logcat return error:
de.timroes.axmlrpc.XMLRPCException: Error getting result from server.

I analyse the response from server, and found that there is an empty element tag - "value"

<member><name>datepost</name><value /></member>

Everything else is OK.

Can it be solved? Thanks!

i cannot include library in my project

i tried to follow the instructions on the github project but they did not work for me. I have to include the library in android studio.

i tried to: 1) copy the whole code in my project but i had a lot of conflicts about package, and, once solved, i began to have problems about lacks of functions not defined 2) i tried to use mvn install command, but it did not work, something like 100 errors displayed 3) i tried to open that project with intelliJ and then i tried to export jar file, but intelliJ told that it s an android project

does anyone have any idea about the procedure to include this library? Thanks a lot in advance

Parse xmlrpc direct to Json with SAX

Hello,

I wrote a parser handler for aXMLRPC that generates a json object model directly from xmlrpc via sax parsing with no intermediate data structures generated during processing. It produces a json object model equivalent to importing an aXMLRPC object model into gson.

I noted that a few projects using aXMLRPC convert the output to json, and this scenario requires multiple object models to be constructed to obtain a json object model. On mobile devices where multi-megabyte datasets are generated, memory limitations cause frequent garbage collection tasks to occur, as well as there being a lot of processing involved.

I also added junit test cases that process xmlrpc datasets stored as text files.

Additional libraries needed are com.google.gson and org.xml.sax. Let me know if you wish to include this code in the project.

Parsing large XML responses

I'm currently not able to parse large endpoint responses due to memory issues (one of the endpoints is a list with 22,746 value entries and no result pagination).

A solution is apparently (as far as i know at the moment) parsing the response using stream parser like SAX (http://developer.android.com/reference/javax/xml/parsers/SAXParser.html). Taking a look at the library, it would be either refactoring or creating a paralel implementation of the ResponseParser and data type Serializer interfaces and implementations (since they are tied to org.w3c.dom.Element).

What do you think?

Difference

Hi
I want just know the difference between aXMLRPC and XMLRPC because i want develop an android application interfacing with odoo(OpenErp) which one can i use

multi-call

Is it possible to make multicall in one request ? How ?

(RFC: system.multicall)

Application being rejected

Hi,

When trying to publish my app, I get this message:
Beginning May 17, 2016, Google Play will block publishing of any new apps or updates containing the unsafe implementation of the interface X509TrustManager.

Can you do something about it ?

Best regards.

Struct Parsing

Structs are currently parsed as follows:

<struct>
   <member>
      <name>
         <string>requser</string>
      </name>
      <value>
         <string>15629368</string>
      </value>
   </member>
</struct>

This however does not conform to the specification where the <name> node does not have any children.

The above mentioned problem lies in StructSerializer.java, line 99

Slow Performance

I am trying to use aXMLRPC:

First, this is great library, only one I could find good for Android Development.


Line 1: XMLRPCClient client = new XMLRPCClient(new URL("http://forums.androidcentral.com/mobiquo/mobiquo.php"));

Line 2: Object[] obj = (Object[]) client.call("get_forum", new Object[] { true });

Before Line 2 is called, # of objects in memory is 77367. After Line 2 is called # of objects in memory are 238494.

Above call should return around a list of 100 items from server. with above number of object being created and recycled, it seem a lot of overhead.

Also WHTHOUT running in debug mode, Line 2 take 8 sec to execute on Galaxy Nexus.

Are there anyway to improve performance of this library?

aXMLRPC and Apache XML-RPC

I'm trying to use aXMLRPC library on Android to get data from my application that use Apache XML-RPC.

But when I make a call I've this exception. I can't figure out if is a problem of aXMLRPC or something else.

Thanks

04-03 13:11:30.649 726-996/? E/﹕ de.timroes.axmlrpc.XMLRPCException: Error getting result from server.
at de.timroes.axmlrpc.ResponseParser.parse(Unknown Source)
at de.timroes.axmlrpc.XMLRPCClient$Caller.call(Unknown Source)
at de.timroes.axmlrpc.XMLRPCClient$Caller.run(Unknown Source)
Caused by: de.timroes.axmlrpc.XMLRPCException: Missing type element inside of value element.
at de.timroes.axmlrpc.serializer.SerializerHandler.deserialize(Unknown Source)
at de.timroes.axmlrpc.serializer.StructSerializer.deserialize(Unknown Source)
at de.timroes.axmlrpc.serializer.SerializerHandler.deserialize(Unknown Source)
at de.timroes.axmlrpc.ResponseParser.getReturnValueFromElement(Unknown Source)
            at de.timroes.axmlrpc.ResponseParser.parse(Unknown Source)
            at de.timroes.axmlrpc.XMLRPCClient$Caller.call(Unknown Source)
            at de.timroes.axmlrpc.XMLRPCClient$Caller.run(Unknown Source)

NullPointerException from call if null parameter in params array

Thank you for useful library!
If I if use one null parameter in params array(fullParams) of the call request:
result = client.call(method, fullParams);
I get Unprescribed exception:
java.lang.NullPointerException
at de.timroes.axmlrpc.serializer.SerializerHandler.serialize(SerializerHandler.java:220)
at de.timroes.axmlrpc.Call.getXMLParam(Call.java:82)
at de.timroes.axmlrpc.Call.getXML(Call.java:64)
at de.timroes.axmlrpc.XMLRPCClient$Caller.call(XMLRPCClient.java:653)
at de.timroes.axmlrpc.XMLRPCClient.call(XMLRPCClient.java:455)
That is of object=null in this code:
throw new XMLRPCException("No serializer found for type '"
+ object.getClass().getName() + "'.");
It looks better:

  1. to send this null parameter.
  2. return described by throws dXMLRPCException

Set Timeout request

Can I set request time out?? when my server off, aplication not stop to request?

Search for a new maintainer

Since I haven't consumed any XML-RPC interface in around 2-3 years now (since luckily REST and JSON are now a widely accepted standard), I am not in use of this library anymore. That way I am also not contributing any time into it anymore. I started developing in version 2, which would have been a completely rewrite from scratch of this library using more modern dependencies, like OkHTTP for network traffic, plans for more extension points (like own de/serializers, custom pre/postprocessors), but due me not needing this library any longer I haven't come far with the implementation.

If you are still consuming XML-RPC interfaces and you are using this library and want to develop or maintain it further: I would be glad to find a new maintainer to who I can transfer this project and who can do whatever he/she likes with it. Also I would recommend changing the package name to be able to publish it on maven central (where you need to have write access to the de.timroes group).

If you feel like maintaining the library especially if you see that you will need it for some more years, just leave me a message here or contact me in person (www.timroes.de).

No deserializer for Ex:Nil

Hi,
I'm using this library using XMLRPCClient.FLAGS_DEFAULT_TYPE_STRING | XMLRPCClient.FLAGS_NIL flags but when the server send me a null value I've this exception on the client:
04-04 08:38:48.835 16314-16767﹕ de.timroes.axmlrpc.XMLRPCException: Error getting result from server.
at de.timroes.axmlrpc.ResponseParser.parse(Unknown Source)
at de.timroes.axmlrpc.XMLRPCClient$Caller.call(Unknown Source)
at de.timroes.axmlrpc.XMLRPCClient$Caller.run(Unknown Source)
Caused by: de.timroes.axmlrpc.XMLRPCException: No deserializer found for type 'ex:nil'.
at de.timroes.axmlrpc.serializer.SerializerHandler.deserialize(Unknown Source)
at de.timroes.axmlrpc.serializer.StructSerializer.deserialize(Unknown Source)
at de.timroes.axmlrpc.serializer.SerializerHandler.deserialize(Unknown Source)
at de.timroes.axmlrpc.serializer.StructSerializer.deserialize(Unknown Source)
at de.timroes.axmlrpc.serializer.SerializerHandler.deserialize(Unknown Source)
at de.timroes.axmlrpc.ResponseParser.getReturnValueFromElement(Unknown Source)
            at de.timroes.axmlrpc.ResponseParser.parse(Unknown Source)
            at de.timroes.axmlrpc.XMLRPCClient$Caller.call(Unknown Source)
            at de.timroes.axmlrpc.XMLRPCClient$Caller.run(Unknown Source)
il'.

There is a way to solve this?

Thanks!

401 return code isn't handled right

When the server returns an 401 unauthorized code, the HTTPUrlConnection throws an IOException, so it isn't handled by the FLAGS_IGNORE_STATUSCODE right now.

encoding issue

Hi there..

I stumbled across a nasty encoding issue that could only be solved by using the vm parameter -Dfile.encoding=UTF-8.

It seems your SimpleXMLCreator is a little liar when it comes to the xml encoding.. The value used in "<?xml version=\"1.0\" encoding=\"UTF-8\"?> is not necessarily the same when de.timroes.axmlrpc.XMLRPCClient.Caller.call(String, Object[]) writes the xml to the http output stream.
Maybe you could replace
OutputStreamWriter stream = new OutputStreamWriter(http.getOutputStream());
by
OutputStreamWriter stream = new OutputStreamWriter(http.getOutputStream(), Charset.forName("UTF-8"));
in this line?

DoubleSerializer doesn't handle Floats

DoubleSerializer attempts to cast [Ff]loats as Doubles, which can't be done.

Since Float & Double are both Numbers, and Number implements .doubleValue(), I recommend changing the cast to that.

return XMLUtil.makeXmlTag(SerializerHandler.TYPE_DOUBLE,
                new DecimalFormat("#0.0#").format(((Number)object).doubleValue()));

Serialization Problem

I'm trying to use your library to connect to OpenERP through XML-RPC, but I'm having the hardest time. I've been trying arrays and ArrayLists, but to no avail.

In order to search for information, you have to send over a 2 dimmensional array of search information such as [['name','=','apple'],['shape','=','round']], but every time I ALWAYS get a "No serializer found" exception. This needs to go at the end, like so:

public void search(ArrayList<ArrayList<String>>... values)
    {
        client.callAsync(this, "execute", credentials.getDatabase(), credentials.getUid(), 
                credentials.getPassword(), table, "search", values);
    }

I've already implemented the same application with iOS, and used Python to connect in this manner, so it has to be something in the XML-RPC specification that should let you do thing. Above, as you can see, I saw you can use an ArrayList, but I dont' mind using a 2 dimensional original array.

Any solutions on how to solve this? Thanks.

Sorry about opening, again. I forgot I was in the wrong account.

publish 1.8.1 to maven central

Hi,

I would greatly appreciate it if you could publish version 1.8.1 to maven central so that other projects on maven central can depend on it.

Cheers and thank you for providing this great piece of software.

Asynchronous call

Create a method callAsync, that allows to make an asynchronous call. The client will then call a listener, when the response is ready.

RFE: Support serializing Collections (Lists,Sets) and BigDecimals

BigDecimals would be nice because of their guaranteed precision, and since they extend Number it's easy to add them. Collections have a toArray() method, and are arguably always arrays in XML-RPC.

In SerializerHandler.java:

        } else if(object instanceof Double || object instanceof Float || object instanceof BigDecimal) {
            s = floating;

(...)

        } else if(object instanceof Object[] || object instanceof Collection) {
            s = array;

In ArraySerializer.java:

    public XmlElement serialize(Object object) {

        Object[] o;
        if (object instanceof Collection){
            o = ((Collection)object).toArray();
        } else {
            o = (Object[])object;
        }

gzip support

In case of:
XMLRPCClient client = new XMLRPCClient(url)); client.setCustomHttpHeader("Accept-Encoding", "gzip");

in the XMLRPCClient.java should handle it with:

Existing Line #689: istream = http.getInputStream();
if ("gzip".equals(conn.getContentEncoding()))
{
istream = new GZIPInputStream(istream);
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.