public interface UniversalClient
This is the client interface to the SOAFaces remote messaging API. This interface, for example, can
proxy calls through to a remote MuleClient
when Mule endpoints are used and can also invoke remote POJO server-side services using the
soafaces://
protocol identifier. These POJO server-side services are defined within your
SOAFaces Bundle (SFB). This allows your Weblet client code to access and invoke
remote services from within your GWT client code.
SOAFaces services endpoints are identified using the following identifier format:
soafaces://<class name>/<endpoint name>
soafaces://com.acme.MyClass/myMethod
This interface allows for simple access to a variety of messaging endpoints. It allows GWT clients to make direct calls to Mule endpoints and SOAFaces endpoints and pass POJO and JSON objects and return POJO and JSON objects back from the remote services.
The posssible callback.onFailure()
exceptions that can be returned
if there is a problem include:
UniveralClientRemoteException
when there is a server-side problem
processing the request.Modifier and Type | Method and Description |
---|---|
void |
dispatch(java.lang.String endpointURI,
com.google.gwt.user.client.rpc.AsyncCallback callback) |
void |
dispatch(java.lang.String endpointURI,
java.lang.Object payload,
com.google.gwt.user.client.rpc.AsyncCallback callback) |
void |
dispatch(java.lang.String endpointURI,
java.lang.Object payload,
java.util.Map<java.lang.String,java.io.Serializable> properties,
com.google.gwt.user.client.rpc.AsyncCallback callback)
Asynchrnous version of send methods.
|
void |
send(java.lang.String endpointURI,
java.lang.Object payload,
java.util.Map<java.lang.String,java.io.Serializable> properties,
UniversalClientJSONCallback callback)
Similar to previous send methods, except will using JSON to serialize any response
returned from the services endpoint.
|
void |
send(java.lang.String endpointURI,
java.lang.Object payload,
java.util.Map<java.lang.String,java.io.Serializable> properties,
UniversalClientPOJOCallback callback)
Call to Mule endpoint or SOAFaces endpoint with payload.
|
void |
send(java.lang.String endpointURI,
java.lang.Object payload,
UniversalClientJSONCallback callback) |
void |
send(java.lang.String endpointURI,
java.lang.Object payload,
UniversalClientPOJOCallback callback)
Similar to previous call but without Map properties arguement.
|
void |
send(java.lang.String endpointURI,
UniversalClientJSONCallback callback) |
void |
send(java.lang.String endpointURI,
UniversalClientPOJOCallback callback)
Similar to previous call and offers and convenient way to call an endpoint
that takes no arguments.
|
void send(java.lang.String endpointURI, java.lang.Object payload, java.util.Map<java.lang.String,java.io.Serializable> properties, UniversalClientPOJOCallback callback)
Payload type can be any built in java type supported by GWT RPC serialization. User defined types that implement IsSerializable are also supported. User defined types that implement java.io.Serializable are NOT supported, built java types that implement java.io.Serializable like String, Integer ...etc are supported. Basic Collections like Map, Lists, and Sets can also be passed and returned.
In addition, JSONObject
is supported. This supports sending a
JSON string (as a JSONObject
) to the server where it
will be (attempted with xstream) serialized into a correspding java object.
JSONObjects can be used to map to JavaBean objects on the server. For
example if you have the object com.foo.MyBean then to create a
JSONObject to pass as payload you would create it like this:
JSONObject props = new JSONObject(); props.put("name", new JSONString("Joe")); props.put("age", new JSONNumber(29)); JSONObject payload = new JSONObject(); payload.put("com.foo.MyBean", props); universalclient.send("vm://doit", payload, null, callback);And like the classical MuleClient, you can using
Object[]
to pass in
multiple arguement. This will work for Mule endpoints and SOAFaces endpoints. The arguments
can be mixture of user defined objects (that implement IsSerializable) or JSONObject or
Java basic types (like String ...etc). So with this the payload can contain one or multiple
arguments to be passed to the service endpoint. Just about all combinations are supported.endpointURI
- Any standard Mule endpoint or SOAFaces endpoint.payload
- All built in java types supported by GWT serialization can be passed
in as an argument. See details above for more types supported. Multiple arguments
can be passed by sending a java.lang.Object array. This allows you to call services
with multiple arguments. You can mix any objects you want into the Object[], including
JSON objects (that will get marshalled to the remote services as POJOs - very cool!).properties
- Optional and only applicable to Mule/ESB endpoints. Name/Value pair
String properties. Map must only contain String
objects for name and value. Set to null if no properties defined.callback
- Asynchronous callback returning result of remote call. Return types have
same serialization restrictions as payload. You can also return JSON objects. See
examples for details.void send(java.lang.String endpointURI, java.lang.Object payload, UniversalClientPOJOCallback callback)
void send(java.lang.String endpointURI, UniversalClientPOJOCallback callback)
void send(java.lang.String endpointURI, java.lang.Object payload, java.util.Map<java.lang.String,java.io.Serializable> properties, UniversalClientJSONCallback callback)
void send(java.lang.String endpointURI, java.lang.Object payload, UniversalClientJSONCallback callback)
void send(java.lang.String endpointURI, UniversalClientJSONCallback callback)
void dispatch(java.lang.String endpointURI, java.lang.Object payload, java.util.Map<java.lang.String,java.io.Serializable> properties, com.google.gwt.user.client.rpc.AsyncCallback callback)
endpointURI
- payload
- properties
- callback
- void dispatch(java.lang.String endpointURI, java.lang.Object payload, com.google.gwt.user.client.rpc.AsyncCallback callback)
void dispatch(java.lang.String endpointURI, com.google.gwt.user.client.rpc.AsyncCallback callback)
Copyright © Grand Logic, Inc. All Rights Reserved.