[appengine-java] Re: What is the best option for RPC (web services) on App engine?
This may be a new shiny valid alternative: http://googlewebtoolkit.blogspot.com/2010/07/gwtrpccommlayer-extending-gwt-rpc-to-do.html?utm_source=feedburnerutm_medium=feedutm_campaign=Feed:+blogspot/NWLT+(Google+Web+Toolkit+Blog)utm_content=Google+Reader I wonder if it will work on Android. On Jun 16, 10:44 am, dilbert dilbert.elbo...@gmail.com wrote: I posted a new bug report:http://bugs.caucho.com/view.php?id=4080 I would like to move further discussion about this issue to the proper place:http://groups.google.com/group/google-appengine-java/browse_thread/th... D. On Jun 16, 12:12 am, Jeff Schnitzer j...@infohazard.org wrote: I would close the old issue and create a new one cut down to just the exception issue. *Are* there any serious RPC alternatives right now? Sounds like gwt-syncproxy isn't quite ready for prime time (and makes me nervous since it's not using a published protocol), the *-WS stuff is a trainwreck, and *-RS is not really convenient as an RPC layer. I would like alternatives. Jeff On Tue, Jun 15, 2010 at 2:41 PM, dilbert dilbert.elbo...@gmail.com wrote: At the time I thought the issues were connected since they threw the same exception so I posted them together. So should I post the issue with exceptions again on the Caucho bug tracker? If this issue is solved I would recommend Hessian as the best RPC mechanism for GAE at this time. Apologies to other readers for the offtopic with bugs. D. On Jun 15, 11:24 pm, Jeff Schnitzer j...@infohazard.org wrote: I think you did yourself a disservice by wrapping these two issues into a single message - it ends up being way too much text to read and otherwise eager volunteers just skip it. The first issue looks like you're not detaching your entities before serializing them. This is a JDO issue. I suggest dropping JDO and using something simpler like Objectify ;-) The issue with exceptions looks more serious. This is something that will need to be fixed in Hessian (or your custom serializer). If you cut down your issue to just this, you might get better results from Caucho. Jeff On Tue, Jun 15, 2010 at 1:55 PM, dilbert dilbert.elbo...@gmail.com wrote: Hi Jeff. I was hoping to hear from You since I saw that You solved some GAE issues on the hessian-interest list. I already posted the issue on the hessian-interest list here: http://maillist.caucho.com/pipermail/hessian-interest/2010-June/00090... I also posted several forum questions: http://forum.caucho.com/showthread.php?t= http://groups.google.com/group/google-appengine-java/browse_thread/th... And a few bug reports: http://bugs.caucho.com/view.php?id=4061 http://code.google.com/p/googleappengine/issues/detail?id=3305 The posts actually describe two issues one with arraylist serialization and the other with exception serialization. The posts also include test projects with code that reproduces the issues. I also managed to solve the issue today by using a custom serializer. Here is how. First the Serializer: public class ThrowableSerializer extends AbstractSerializer { �...@override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (obj != null) { final Class cl = obj.getClass(); if (out.addRef(obj)) return; int ref = out.writeObjectBegin(cl.getName()); Throwable tr = (Throwable) obj; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(tr); if (ref -1) { out.writeString(value); out.writeBytes(bos.toByteArray()); out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(1); out.writeString(value); out.writeObjectBegin(cl.getName()); } out.writeBytes(bos.toByteArray()); } } finally { oos.close(); bos.close(); } } else out.writeNull(); } } The other class we need is the Deserializer: public class ThrowableDeserializer extends AbstractDeserializer { //private static final Logger l = Logger.getLogger(ThrowableDeserializer.class.getName()); �...@override public Class getType() { return Throwable.class; } �...@override public Object readMap(AbstractHessianInput in) throws IOException { int ref = in.addRef(null); byte[] initValue = null; while (!in.isEnd()) { String
[appengine-java] Re: What is the best option for RPC (web services) on App engine?
I posted a new bug report: http://bugs.caucho.com/view.php?id=4080 I would like to move further discussion about this issue to the proper place: http://groups.google.com/group/google-appengine-java/browse_thread/thread/c4fb4f414c425ca1 D. On Jun 16, 12:12 am, Jeff Schnitzer j...@infohazard.org wrote: I would close the old issue and create a new one cut down to just the exception issue. *Are* there any serious RPC alternatives right now? Sounds like gwt-syncproxy isn't quite ready for prime time (and makes me nervous since it's not using a published protocol), the *-WS stuff is a trainwreck, and *-RS is not really convenient as an RPC layer. I would like alternatives. Jeff On Tue, Jun 15, 2010 at 2:41 PM, dilbert dilbert.elbo...@gmail.com wrote: At the time I thought the issues were connected since they threw the same exception so I posted them together. So should I post the issue with exceptions again on the Caucho bug tracker? If this issue is solved I would recommend Hessian as the best RPC mechanism for GAE at this time. Apologies to other readers for the offtopic with bugs. D. On Jun 15, 11:24 pm, Jeff Schnitzer j...@infohazard.org wrote: I think you did yourself a disservice by wrapping these two issues into a single message - it ends up being way too much text to read and otherwise eager volunteers just skip it. The first issue looks like you're not detaching your entities before serializing them. This is a JDO issue. I suggest dropping JDO and using something simpler like Objectify ;-) The issue with exceptions looks more serious. This is something that will need to be fixed in Hessian (or your custom serializer). If you cut down your issue to just this, you might get better results from Caucho. Jeff On Tue, Jun 15, 2010 at 1:55 PM, dilbert dilbert.elbo...@gmail.com wrote: Hi Jeff. I was hoping to hear from You since I saw that You solved some GAE issues on the hessian-interest list. I already posted the issue on the hessian-interest list here: http://maillist.caucho.com/pipermail/hessian-interest/2010-June/00090... I also posted several forum questions: http://forum.caucho.com/showthread.php?t= http://groups.google.com/group/google-appengine-java/browse_thread/th... And a few bug reports: http://bugs.caucho.com/view.php?id=4061 http://code.google.com/p/googleappengine/issues/detail?id=3305 The posts actually describe two issues one with arraylist serialization and the other with exception serialization. The posts also include test projects with code that reproduces the issues. I also managed to solve the issue today by using a custom serializer. Here is how. First the Serializer: public class ThrowableSerializer extends AbstractSerializer { �...@override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (obj != null) { final Class cl = obj.getClass(); if (out.addRef(obj)) return; int ref = out.writeObjectBegin(cl.getName()); Throwable tr = (Throwable) obj; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(tr); if (ref -1) { out.writeString(value); out.writeBytes(bos.toByteArray()); out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(1); out.writeString(value); out.writeObjectBegin(cl.getName()); } out.writeBytes(bos.toByteArray()); } } finally { oos.close(); bos.close(); } } else out.writeNull(); } } The other class we need is the Deserializer: public class ThrowableDeserializer extends AbstractDeserializer { //private static final Logger l = Logger.getLogger(ThrowableDeserializer.class.getName()); �...@override public Class getType() { return Throwable.class; } �...@override public Object readMap(AbstractHessianInput in) throws IOException { int ref = in.addRef(null); byte[] initValue = null; while (!in.isEnd()) { String key = in.readString(); if (key.equals(value)) initValue = in.readBytes(); else in.readString(); } in.readMapEnd(); ByteArrayInputStream bis = new ByteArrayInputStream(initValue); ObjectInputStream ois = new ObjectInputStream(bis); try { Object value = ois.readObject(); in.setRef(ref,
Re: [appengine-java] Re: What is the best option for RPC (web services) on App engine?
I think you did yourself a disservice by wrapping these two issues into a single message - it ends up being way too much text to read and otherwise eager volunteers just skip it. The first issue looks like you're not detaching your entities before serializing them. This is a JDO issue. I suggest dropping JDO and using something simpler like Objectify ;-) The issue with exceptions looks more serious. This is something that will need to be fixed in Hessian (or your custom serializer). If you cut down your issue to just this, you might get better results from Caucho. Jeff On Tue, Jun 15, 2010 at 1:55 PM, dilbert dilbert.elbo...@gmail.com wrote: Hi Jeff. I was hoping to hear from You since I saw that You solved some GAE issues on the hessian-interest list. I already posted the issue on the hessian-interest list here: http://maillist.caucho.com/pipermail/hessian-interest/2010-June/000908.html I also posted several forum questions: http://forum.caucho.com/showthread.php?t= http://groups.google.com/group/google-appengine-java/browse_thread/thread/c4fb4f414c425ca1 And a few bug reports: http://bugs.caucho.com/view.php?id=4061 http://code.google.com/p/googleappengine/issues/detail?id=3305 The posts actually describe two issues one with arraylist serialization and the other with exception serialization. The posts also include test projects with code that reproduces the issues. I also managed to solve the issue today by using a custom serializer. Here is how. First the Serializer: public class ThrowableSerializer extends AbstractSerializer { �...@override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (obj != null) { final Class cl = obj.getClass(); if (out.addRef(obj)) return; int ref = out.writeObjectBegin(cl.getName()); Throwable tr = (Throwable) obj; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(tr); if (ref -1) { out.writeString(value); out.writeBytes(bos.toByteArray()); out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(1); out.writeString(value); out.writeObjectBegin(cl.getName()); } out.writeBytes(bos.toByteArray()); } } finally { oos.close(); bos.close(); } } else out.writeNull(); } } The other class we need is the Deserializer: public class ThrowableDeserializer extends AbstractDeserializer { //private static final Logger l = Logger.getLogger(ThrowableDeserializer.class.getName()); �...@override public Class getType() { return Throwable.class; } �...@override public Object readMap(AbstractHessianInput in) throws IOException { int ref = in.addRef(null); byte[] initValue = null; while (!in.isEnd()) { String key = in.readString(); if (key.equals(value)) initValue = in.readBytes(); else in.readString(); } in.readMapEnd(); ByteArrayInputStream bis = new ByteArrayInputStream(initValue); ObjectInputStream ois = new ObjectInputStream(bis); try { Object value = ois.readObject(); in.setRef(ref, value); return value; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { ois.close(); bis.close(); } } �...@override public Object readObject(AbstractHessianInput in, Object[] fieldNames) throws IOException { int ref = in.addRef(null); byte[] initValue = null; for (Object o : fieldNames) { if (o instanceof String) { final String key = (String) o; if (key.equals(value)) initValue = in.readBytes(); else in.readObject(); } } ByteArrayInputStream bis = new ByteArrayInputStream(initValue); ObjectInputStream ois = new ObjectInputStream(bis); try { Object value = ois.readObject(); in.setRef(ref, value); return value; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { ois.close(); bis.close(); } } } I'm not sure if the readMap part is actually needed since I rearranged this code from another example. Also, a ThrowableSerializerFactory is needed: public class ThrowableSerializerFactory extends
[appengine-java] Re: What is the best option for RPC (web services) on App engine?
At the time I thought the issues were connected since they threw the same exception so I posted them together. So should I post the issue with exceptions again on the Caucho bug tracker? If this issue is solved I would recommend Hessian as the best RPC mechanism for GAE at this time. Apologies to other readers for the offtopic with bugs. D. On Jun 15, 11:24 pm, Jeff Schnitzer j...@infohazard.org wrote: I think you did yourself a disservice by wrapping these two issues into a single message - it ends up being way too much text to read and otherwise eager volunteers just skip it. The first issue looks like you're not detaching your entities before serializing them. This is a JDO issue. I suggest dropping JDO and using something simpler like Objectify ;-) The issue with exceptions looks more serious. This is something that will need to be fixed in Hessian (or your custom serializer). If you cut down your issue to just this, you might get better results from Caucho. Jeff On Tue, Jun 15, 2010 at 1:55 PM, dilbert dilbert.elbo...@gmail.com wrote: Hi Jeff. I was hoping to hear from You since I saw that You solved some GAE issues on the hessian-interest list. I already posted the issue on the hessian-interest list here: http://maillist.caucho.com/pipermail/hessian-interest/2010-June/00090... I also posted several forum questions: http://forum.caucho.com/showthread.php?t= http://groups.google.com/group/google-appengine-java/browse_thread/th... And a few bug reports: http://bugs.caucho.com/view.php?id=4061 http://code.google.com/p/googleappengine/issues/detail?id=3305 The posts actually describe two issues one with arraylist serialization and the other with exception serialization. The posts also include test projects with code that reproduces the issues. I also managed to solve the issue today by using a custom serializer. Here is how. First the Serializer: public class ThrowableSerializer extends AbstractSerializer { �...@override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (obj != null) { final Class cl = obj.getClass(); if (out.addRef(obj)) return; int ref = out.writeObjectBegin(cl.getName()); Throwable tr = (Throwable) obj; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(tr); if (ref -1) { out.writeString(value); out.writeBytes(bos.toByteArray()); out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(1); out.writeString(value); out.writeObjectBegin(cl.getName()); } out.writeBytes(bos.toByteArray()); } } finally { oos.close(); bos.close(); } } else out.writeNull(); } } The other class we need is the Deserializer: public class ThrowableDeserializer extends AbstractDeserializer { //private static final Logger l = Logger.getLogger(ThrowableDeserializer.class.getName()); �...@override public Class getType() { return Throwable.class; } �...@override public Object readMap(AbstractHessianInput in) throws IOException { int ref = in.addRef(null); byte[] initValue = null; while (!in.isEnd()) { String key = in.readString(); if (key.equals(value)) initValue = in.readBytes(); else in.readString(); } in.readMapEnd(); ByteArrayInputStream bis = new ByteArrayInputStream(initValue); ObjectInputStream ois = new ObjectInputStream(bis); try { Object value = ois.readObject(); in.setRef(ref, value); return value; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { ois.close(); bis.close(); } } �...@override public Object readObject(AbstractHessianInput in, Object[] fieldNames) throws IOException { int ref = in.addRef(null); byte[] initValue = null; for (Object o : fieldNames) { if (o instanceof String) { final String key = (String) o; if (key.equals(value)) initValue = in.readBytes(); else in.readObject(); } } ByteArrayInputStream bis = new ByteArrayInputStream(initValue); ObjectInputStream ois = new ObjectInputStream(bis); try {
Re: [appengine-java] Re: What is the best option for RPC (web services) on App engine?
I would close the old issue and create a new one cut down to just the exception issue. *Are* there any serious RPC alternatives right now? Sounds like gwt-syncproxy isn't quite ready for prime time (and makes me nervous since it's not using a published protocol), the *-WS stuff is a trainwreck, and *-RS is not really convenient as an RPC layer. I would like alternatives. Jeff On Tue, Jun 15, 2010 at 2:41 PM, dilbert dilbert.elbo...@gmail.com wrote: At the time I thought the issues were connected since they threw the same exception so I posted them together. So should I post the issue with exceptions again on the Caucho bug tracker? If this issue is solved I would recommend Hessian as the best RPC mechanism for GAE at this time. Apologies to other readers for the offtopic with bugs. D. On Jun 15, 11:24 pm, Jeff Schnitzer j...@infohazard.org wrote: I think you did yourself a disservice by wrapping these two issues into a single message - it ends up being way too much text to read and otherwise eager volunteers just skip it. The first issue looks like you're not detaching your entities before serializing them. This is a JDO issue. I suggest dropping JDO and using something simpler like Objectify ;-) The issue with exceptions looks more serious. This is something that will need to be fixed in Hessian (or your custom serializer). If you cut down your issue to just this, you might get better results from Caucho. Jeff On Tue, Jun 15, 2010 at 1:55 PM, dilbert dilbert.elbo...@gmail.com wrote: Hi Jeff. I was hoping to hear from You since I saw that You solved some GAE issues on the hessian-interest list. I already posted the issue on the hessian-interest list here: http://maillist.caucho.com/pipermail/hessian-interest/2010-June/00090... I also posted several forum questions: http://forum.caucho.com/showthread.php?t= http://groups.google.com/group/google-appengine-java/browse_thread/th... And a few bug reports: http://bugs.caucho.com/view.php?id=4061 http://code.google.com/p/googleappengine/issues/detail?id=3305 The posts actually describe two issues one with arraylist serialization and the other with exception serialization. The posts also include test projects with code that reproduces the issues. I also managed to solve the issue today by using a custom serializer. Here is how. First the Serializer: public class ThrowableSerializer extends AbstractSerializer { �...@override public void writeObject(Object obj, AbstractHessianOutput out) throws IOException { if (obj != null) { final Class cl = obj.getClass(); if (out.addRef(obj)) return; int ref = out.writeObjectBegin(cl.getName()); Throwable tr = (Throwable) obj; ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); try { oos.writeObject(tr); if (ref -1) { out.writeString(value); out.writeBytes(bos.toByteArray()); out.writeMapEnd(); } else { if (ref == -1) { out.writeInt(1); out.writeString(value); out.writeObjectBegin(cl.getName()); } out.writeBytes(bos.toByteArray()); } } finally { oos.close(); bos.close(); } } else out.writeNull(); } } The other class we need is the Deserializer: public class ThrowableDeserializer extends AbstractDeserializer { //private static final Logger l = Logger.getLogger(ThrowableDeserializer.class.getName()); �...@override public Class getType() { return Throwable.class; } �...@override public Object readMap(AbstractHessianInput in) throws IOException { int ref = in.addRef(null); byte[] initValue = null; while (!in.isEnd()) { String key = in.readString(); if (key.equals(value)) initValue = in.readBytes(); else in.readString(); } in.readMapEnd(); ByteArrayInputStream bis = new ByteArrayInputStream(initValue); ObjectInputStream ois = new ObjectInputStream(bis); try { Object value = ois.readObject(); in.setRef(ref, value); return value; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } finally { ois.close(); bis.close(); } } �...@override public Object readObject(AbstractHessianInput in, Object[] fieldNames) throws IOException { int ref = in.addRef(null); byte[] initValue =
[appengine-java] Re: What is the best option for RPC (web services) on App engine?
http://code.google.com/p/gwt-syncproxy/ may be suitable for your needs. On Jun 10, 11:13 pm, dilbert dilbert.elbo...@gmail.com wrote: First I'd like to explain what I mean by RPC. I'd like to be able to write interfaces like this (simple Java interface): public interface EchoService { String echo(String message); } The framework would allow the creation of client classes that would handle the serialization from/to the RPC service. Of course the framework should support the serialization of ArrayLists, HashMaps and other collections and should also support the serialization of objects marked with the java.io.Serializable interface (or some other interface). We would create the RPC Client this way: EchoService echoService = RpcClientFactory.createInstance(EchoService.class,http://bla.com/ smartApp/echo); And of course use it this way: String echoMessage = echoService.echo(The message !!!); The server side servlet would implement the previously mentioned interface. public class Service extends WhateverServlet implements EchoService { @Override String echo(String message) { return server sends: + message; } } A few additional nice features to have would be: -support for asynchronous calls (where the developer would provide a callback for handling the result, similar to GWT RPC) -the developers should be able to access the RPC client somehow to be able to handle Cookies or other http headers. -the client side should be usable from Android. After a long search I have found that the framework that most closely matches these requirements is Hessian (http://hessian.caucho.com/). It uses a binary protocol so it should be very fast and it works on Android. AFAIK it does not support async calls. However, not all is well. The current Hessian implementation does not handle exceptions well. It throws a SecurityException like this: java.lang.SecurityException: java.lang.IllegalAccessException: Reflection is not allowed on private java.lang.Throwable java.lang.Throwable.cause I considered GWT RPC for a while but it does not have a proper Java client or I could not find one. So I wanted to ask is there any other library that could be used in this case? Could the App engine team write such a library and add it to the SDK. Any suggestions? -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
[appengine-java] Re: What is the best option for RPC (web services) on App engine?
I have implemented a JSON based RPC framework - refer http://code.google.com/p/amazingapis/wiki/JsonServlet_JsonClient_mechanism So basically , This is cmd framework where you can send request string as Json streams on HTTP and your JSONServlet on the server will read client requests and pass invoke the corresponding cmd. The documentation is not great. Let me know if you want to use it. I can upload a newer version. On Jun 10, 9:13 am, dilbert dilbert.elbo...@gmail.com wrote: First I'd like to explain what I mean by RPC. I'd like to be able to write interfaces like this (simple Java interface): public interface EchoService { String echo(String message); } The framework would allow the creation of client classes that would handle the serialization from/to the RPC service. Of course the framework should support the serialization of ArrayLists, HashMaps and other collections and should also support the serialization of objects marked with the java.io.Serializable interface (or some other interface). We would create the RPC Client this way: EchoService echoService = RpcClientFactory.createInstance(EchoService.class,http://bla.com/ smartApp/echo); And of course use it this way: String echoMessage = echoService.echo(The message !!!); The server side servlet would implement the previously mentioned interface. public class Service extends WhateverServlet implements EchoService { @Override String echo(String message) { return server sends: + message; } } A few additional nice features to have would be: -support for asynchronous calls (where the developer would provide a callback for handling the result, similar to GWT RPC) -the developers should be able to access the RPC client somehow to be able to handle Cookies or other http headers. -the client side should be usable from Android. After a long search I have found that the framework that most closely matches these requirements is Hessian (http://hessian.caucho.com/). It uses a binary protocol so it should be very fast and it works on Android. AFAIK it does not support async calls. However, not all is well. The current Hessian implementation does not handle exceptions well. It throws a SecurityException like this: java.lang.SecurityException: java.lang.IllegalAccessException: Reflection is not allowed on private java.lang.Throwable java.lang.Throwable.cause I considered GWT RPC for a while but it does not have a proper Java client or I could not find one. So I wanted to ask is there any other library that could be used in this case? Could the App engine team write such a library and add it to the SDK. Any suggestions? -- You received this message because you are subscribed to the Google Groups Google App Engine for Java group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.