Anyone using soafaces for client server communication ?

12 views
Skip to first unread message

mike_mac

unread,
Oct 30, 2009, 3:04:18 PM10/30/09
to Google Web Toolkit

http://code.google.com/p/soafaces/

I've tried to get it working but it seems to be broken ... it claims
to allow passing of Object[] but when I try to use it (Object[] objs =
new Object[2]) I get a Serialization exception which seems to be from
generated code ...

com.google.gwt.user.client.rpc.SerializationException:
[Ljava.lang.Object;
at
org.soafaces.services.client.rpc.UniversalClientRPC_TypeSerializer.raiseSerializationException
(transient
source for
soafaces.services.client.rpc.UniversalClientRPC_TypeSerializer:3133)
at
soafaces.services.client.rpc.UniversalClientRPC_TypeSerializer.serialize
(Native Method)

It does work if I pass a single argument, anyone have any experience
using this ?

mike_mac

unread,
Oct 30, 2009, 5:12:04 PM10/30/09
to Google Web Toolkit

On further investigation this seems to be a hosted mode issue and
different behaviour of instanceof between hosted mode and complied
versions of the code.

Passing an Object[] called obj that has two objects that implement
IsSerializable
results in "obj instanceof Serializable" returning true in hosted mode
but false in the compiled Javascript.

See
org.soafaces.services.client.rpcGenericDataUtil.createGenericDataWrapper
(Object obj) in soafaces source.

Anyone have a logical explanation why hosted mode thinks its a
Serializable object ? Object is not Serializable right so neither
should Object[] right ?

Sam Taha

unread,
Nov 5, 2009, 7:25:36 PM11/5/09
to Google Web Toolkit
Hi Mike,

I think I see the problem. In Hosted mode, java is evaluating the
Object[] as instanceof Serializable since per java spec every java
array implements Serializable interface. Production mode must be
letting this slip by. So actually looks like an inconsistency between
compiled javascript mode and java spec.

I will verify, but the fix should be easy in soafaces to move the the
check for instanceof Object[] earlier in the if else chain. I will
work on a bug fix for soafaces.

Thanks,
Sam

R.Domingo

unread,
Nov 12, 2009, 4:00:55 AM11/12/09
to Google Web Toolkit
Hi Sam and Mike,

I'm currently reviewing Soafaces but:
- I can't get it 100% to work;
- I couldnt find a soafaces related forum.

It could be my problem is related to the problem just described.
Because the object (string) returned by service doesn't seem to be
received by the client.

I created a normal gwt (1.5.2) client and added:
- jettizon
- soafaces-services-client
- soafaces-services-servlet-nomule
- xstream
- added lines to ...gwt.xml:
<source path="client"/>
<inherits name='org.soafaces.services.Services'/>

When running my app and invoking the service
'onUniversalClientSuccess' is triggered. So far so good, but the
string sended by server "You got it" isn't received.
The result object parameter of onUniversalClientSuccess is null, see
my code and log output below.


Any ideas / tips / additional examples ?


I get number of errors/warnings in my log:
[DEBUG] Rebinding org.soafaces.services.client.rpc.UniversalClientRPC
[DEBUG] Invoking <generate-with
class='com.google.gwt.user.rebind.rpc.ServiceInterfaceProxyGenerator'/
>
[DEBUG] Generating client proxy for remote service interface
'org.soafaces.services.client.rpc.UniversalClientRPC'
[DEBUG] Analyzing
'org.soafaces.services.client.rpc.UniversalClientRPC' for serializable
types
[DEBUG] Analyzing methods:
[DEBUG] public abstract void dispatchAny(java.lang.String endpointURI,
org.soafaces.services.client.rpc.GenericDataWrapper payload,
java.util.Map<java.lang.String, java.io.Serializable> properties)
throws org.soafaces.services.client.rpc.UniversalClientRemoteException
[DEBUG] Parameter: org.soafaces.services.client.rpc.GenericDataWrapper
payload
[DEBUG] org.soafaces.services.client.rpc.GenericDataWrapper
[DEBUG] Verifying instantiability
[DEBUG] org.soafaces.services.client.rpc.GenericDataWrapper
[DEBUG] Analyzing the fields of type
'org.soafaces.services.client.rpc.GenericDataWrapper' that qualify for
serialization
[DEBUG] public java.io.Serializable _PojoSerial
[DEBUG] java.io.Serializable
[DEBUG] Verifying instantiability
[DEBUG] nl.telecats.web.gwt.common.model.ServiceEvent
[DEBUG] Analyzing the fields of type
'nl.telecats.web.gwt.common.model.ServiceEvent' that qualify for
serialization
....
[DEBUG] Analyzing the fields of type
'com.google.gwt.i18n.client.impl.ConstantMap' that qualify for
serialization
[WARN] Field 'private final
com.google.gwt.i18n.client.impl.ConstantMap.OrderedConstantSet<java.lang.String>
keys' will not be serialized because it is final
....
[DEBUG] com.extjs.gxt.ui.client.data.BaseListLoadResult<? extends
java.lang.Object>
[DEBUG] Checking parameters of
'com.extjs.gxt.ui.client.data.BaseListLoadResult<? extends
java.lang.Object>'
[DEBUG] Checking type argument 0 of type
'com.extjs.gxt.ui.client.data.BaseListLoadResult<Data>' because it is
exposed as an array with a maximum dimension of 1 in this type or one
of its subtypes
[DEBUG] java.lang.Object[]
[DEBUG] Analyzing component type:
[DEBUG] java.lang.Object
[WARN] In order to produce smaller client-side code, 'Object' is not
allowed; consider using a more specific type
...
[DEBUG] java.util.Vector<? extends java.lang.Object>
[WARN] Checking all subtypes of Object which qualify for serialization
[DEBUG] nl.telecats.web.gwt.client.mvc.helper.MVCViewInstanceHolder
[ERROR] Type
'nl.telecats.web.gwt.client.mvc.helper.MVCViewInstanceHolder' was not
serializable and has no concrete serializable subtypes
[DEBUG] com.extjs.gxt.ui.client.data.BeanModel
[DEBUG] Verifying instantiability
[DEBUG] com.extjs.gxt.ui.client.data.BeanModel
[DEBUG] Analyzing the fields of type
'com.extjs.gxt.ui.client.data.BeanModel' that qualify for
serialization
[DEBUG] protected java.lang.Object bean
[DEBUG] java.lang.Object
[WARN] In order to produce smaller client-side code, 'Object' is not
allowed; consider using a more specific type

Code I added to my app:
private static final String UNIVERSAL_CLIENT_SERVLET = "/
gwtMulePoc.Application4HostedBrowser/SOAFacesRPCServlet";
private UniversalClient _oClient;

private void testMule() {
String stEndpoint1 = "soafaces://
gwtMulePoc.services.HelloWorldService/helloThereEndpoint";
//Create the UniversalClient Async Callback
UniversalClientPOJOCallback oMulePOJOCallback = new
UniversalClientPOJOCallback() {

public void onUniversalClientSuccess(Object result) {
//Serivces returns a String
String returnVal = (String) result;
Info.display("Info","Wow this was a success! Return value: "
+ returnVal);
}

public void onFailure(Throwable ex) {
Info.display("Info","Error during UniversalClient call: " +
ex.getMessage());
}
};

//Simply use the UniversalClient send method to call remote
service
//This service endpoint takes not arguments and returns a String
getUniversalClient().send(stEndpoint1, oMulePOJOCallback);

}

private UniversalClient getUniversalClient() {
if(_oClient == null) {
_oClient = UniversalClientFactory.getInstance
().getUniversalClient(UNIVERSAL_CLIENT_SERVLET);
}
return _oClient;
}

package gwtMulePoc.services;

import org.soafaces.services.annotation.ServiceEndpoint;


public class HelloWorldService {

@ServiceEndpoint (name="helloThereEndpoint")
public String helloThere() {
return "You got it";
}
}


On Nov 6, 1:25 am, Sam Taha <taha...@gmail.com> wrote:
> Hi Mike,
>
> I think I see the problem. In Hosted mode, java is evaluating the
> Object[] as instanceof Serializable since per java spec every java
> array implements Serializable interface. Production mode must be
> letting this slip by. So actually looks like an inconsistency between
> compiled javascript mode and java spec.
>
> I will verify, but the fix should be easy insoafacesto move the the

Sam Taha

unread,
Nov 22, 2009, 1:49:21 PM11/22/09
to Google Web Toolkit
Do you only see this problem in hosted mode? Do you see it in web
mode?

What version of soafaces are you using?

Are you getting any servlet errors?

On Nov 12, 4:00 am, "R.Domingo" <raym...@domingo.nl> wrote:
> Hi Sam and Mike,
>
> I'm currently reviewingSoafacesbut:
> - I can't get it 100% to work;
> - I couldnt find asoafacesrelated forum.

R.Domingo

unread,
Nov 23, 2009, 4:55:52 AM11/23/09
to Google Web Toolkit
Hi Sam,

Thank you for responding, I really like to get soafaces up and
running.

The jars I'm using are:
jettison-1.0.1.jar
soafaces-services-client-2.4.2.jar
soafaces-services-servlet-nomule-2.4.2.jar
xstream-1.2.2.jar

In my hosted browser at least:
- onUniversalClientSuccess is triggered

But when building a jar and depoying in tomcat:
- onFailure is triggered
I couldn't find any error message, the exception thrown in onFailure
doesn't have a message in it.

Any ideas ?
Or is there any change you could post an (maven2 enabled) example
using gwt and soafaces ?


On Nov 22, 7:49 pm, Sam Taha <taha...@gmail.com> wrote:
> Do you only see this problem in hosted mode? Do you see it in web
> mode?
>
> What version ofsoafacesare you using?

R.Domingo

unread,
Nov 23, 2009, 4:57:01 AM11/23/09
to Google Web Toolkit
correction:
'But when building a JAR and depoying in tomcat: '

I'm not building a JAR, but I'm building a war...

On Nov 23, 10:55 am, "R.Domingo" <raym...@domingo.nl> wrote:
> Hi Sam,
>
> Thank you for responding, I really like to getsoafacesup and
Reply all
Reply to author
Forward
0 new messages