Actually, same deal there, you shouldn't really be trying to use a
SOAP webservice (which I assume is what you mean, since you are
talking about RemoteException?) from a small embedded device either.
The reason "why is this" is that Android has a limited API, which is
designed for it's limited environment, it's not a full stack JRE with
all Java libraries ported - by design.

What I said earlier still applies - use "XML over HTTP (RESTy)."  I
have several Android applications that need to talk to server side
data layers, and they do it using REST type calls (the HTTP and XML
support in Android is there, and there is no overheard in terms of
envelope, proxy stub classes, and so on).

Some people have gotten SOAP to work using libraries like kSOAP (which
is designed for embedded):
http://groups.google.com/group/android-developers/browse_thread/thread/9b246db7d612a6b5.

Yet, I would still argue that you don't really *want* to do that, for
performance and maintenance reasons, etc. If you have existing SOAP
services then you have a strong incentive to re-use them, sure, and in
that case you might want to try to work out SOAP on Android (though
personally I would probably make a SOAP proxy on my own server, and
call that via POX even in those cases, unless load/etc was
prohibitive). If you DON'T have existing SOAP services that you need
to consume, then you really don't have a good reason to use SOAP, use
REST or JSON or something whereby you can just hit an HTTP endpoint
and parse the resulting XML payload.

This has been discussed on the board a few times before, and some
people agree with the approach I am advocating here (don't use SOAP
unless you really really have to, and in 99.9% of cases you don't
really have to), some don't - just throwing it out there so you know
the options and you can make an informed decision:

http://groups.google.com/group/android-developers/browse_thread/thread/c0b7fd0a3fd99c0d
http://groups.google.com/group/android-developers/browse_thread/thread/d4c64daf86813067






On Apr 25, 2:09 am, scimitar <[EMAIL PROTECTED]> wrote:
> Ok. Now I'm trying to communicate with a webservice. The problem is
> that I need to import java.rmi.RemoteException for something like:
> String ret = (String) call.invoke(String method,  Object[] o);
> But the Android Eclipse plugin would not allow me to import
> java.rmi.RemoteException, saying that it cannot resolve it. Why is
> this?
>
> thanks
>
> On Apr 23, 3:53 pm, "Dan U." <[EMAIL PROTECTED]> wrote:
>
> > Well, java.sql.NClob appears to be the problem. It looks like that
> > class is in rt.jar in a normal Java jre. Probably not part of Android
> > because I doubt they expect people to be doing this (I agree with
> > Charlie on why). I don't know why you don't have a choice, but I'll
> > say it looks like a bad design if someone has restricted you to doing
> > that.
>
> > So, if it's absolutely the only way you can do this, it *might* be
> > possible to extract the classes you need from rt.jar and include them
> > in your application. I think the dx tool will handle converting them
> > to dalvik. Not sure what the licensing is on doing something like
> > that. Might want to read it.
>
> > On Apr 23, 12:25 pm, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > Hi, thanks for your reply. But I really have no choice in this matter.
> > > Using JDBC is my best bet here, and I would appreciate if somebody
> > > could tell me what's going on.
>
> > > On Apr 23, 2:56 pm, Charlie Collins <[EMAIL PROTECTED]> wrote:
>
> > > > I don't have any insight to help in terms of answering your question
> > > > about using a JDBC driver from Android, but would offer one
> > > > suggestion: don't try it to begin with.
>
> > > > You would probably be a lot better off connecting to a server using
> > > > XML over HTTP (RESTy) or such, and then doing your JDBC stuff on the
> > > > *server*. Write your own RESTy DAL API on the server side, and connect
> > > > to that from Android - a lot more performant (and easier to maintain
> > > > going forward, decoupling), and you can control all the data aspects
> > > > on the server using any library or technology you want.
>
> > > > Going directly from the Android client to adatabaseserver over JDBC
> > > > is going to be problematic, and even if you do get it to work, a lot
> > > > more overhead than using a server. Remember it's a small embedded
> > > > device.
>
> > > > On Apr 23, 3:38 am, scimitar <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi,
>
> > > > > I'm trying to connect to an external mysqldatabase. The code is
> > > > > something like:
>
> > > > > try
>
> > > > > >        {
> > > > > >            Class.forName(DBCLASS).newInstance();
> > > > > >        }
> > > > > >        catch (Exception e)
> > > > > >        {
> > > > > >            Log.i("DataLayer", "unable to load jdbc driver");
> > > > > >        }
> > > > > >              // Connect to thedatabase
> > > > > >        // 
> > > > > > jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][&param2=value2].....
>
> > > > > >        try
> > > > > >        {
> > > > > >            connection = DriverManager.getConnection(
> > > > > >                DBCONNSTRING + DBHOST + "/" + DBNAME + "?user=" + 
> > > > > > USER + "&password=" + PASSWORD);
>
> > > > > >        }
> > > > > >        catch (Exception e)
> > > > > >        {
>
> > > > > >        }
>
> > > > > Basically the 'DriverManager.getConnection()' call fails. The error
> > > > > messages are:
>
> > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
>
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass 'java.sql.NClob' 0x40069968 threw
> > > > > > an exception
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass
> > > > > > 'com.mysql.jdbc.LocalizedErrorMessages_en_US' 0x40069968 threw an
> > > > > > exception
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass
> > > > > > 'com.mysql.jdbc.LocalizedErrorMessages_en' 0x40069968 threw an 
> > > > > > exception
> > > > > > I/dalvikvm-heap(  596): GC! (75 sec since last GC)
> > > > > > I/dalvikvm-heap(  596): GC old usage 90.6%; now 0.985MB used / 
> > > > > > 1.971MB
> > > > > > soft max (2.062MB real max)
> > > > > > I/dalvikvm-heap(  596): GC freed 1736 objects / 106824 bytes in 56ms
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass
> > > > > > 'com.mysql.jdbc.LocalizedErrorMessages' 0x40069968 threw an 
> > > > > > exception
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass
> > > > > > 'com.mysql.jdbc.LocalizedErrorMessages_en_US' 0x40018950 threw an
> > > > > > exception
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass
> > > > > > 'com.mysql.jdbc.LocalizedErrorMessages_en' 0x40018950 threw an 
> > > > > > exception
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ClassNotFoundException; from
> > > > > > PathClassLoader.java:205 not caught locally
> > > > > > D/dalvikvm(  596): NOTE: loadClass
> > > > > > 'com.mysql.jdbc.LocalizedErrorMessages' 0x40018950 threw an 
> > > > > > exception
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/RuntimeException; from
> > > > > > Messages.java:68 not caught locally
> > > > > > W/dalvikvm(  596): Exception Ljava/lang/RuntimeException; thrown
> > > > > > during Lcom/mysql/jdbc/Messages;.<clinit>
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > > > from Util.java:350 not caught locally
> > > > > > W/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > > > thrown during Lcom/mysql/jdbc/Util;.<clinit>
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > > > from ViewRoot.java:964 not caught locally
> > > > > > D/dalvikvm(  596): Exception Ljava/lang/ExceptionInInitializerError;
> > > > > > from ZygoteInit.java:1555 not caught locally
>
> > > > > I would really appreciate if somebody could help me.
>
> > > > > thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to