|
StandaloneGwtClient
How to use the UniversalClient API in your GWT applications to send and receive SOA messages.
IntroductionThis section describes how you can use the Services (UniversalClient) portion of the SOAFaces API to make SOA messaging/RPC calls from any GWT client application with no RPC complexity. All you do is set an annotation endpoint marker on methods on a POJO object and then reference that endpoint in your UniversalClient calls. You can send POJO and JSON objects as arguments and return POJO/JSON values without dealing with serialization and RPC related logic. See the universalapp WAR application for an example of how to use the UniversalClient API in a standalone WAR application. The WAR file also contains the source for the demonstration application. To get started:
If you want to also access endpoint services that include soafaces endpoints along with Mule endpoints (like JMS, SOAP ...etc) use the jars shown below in your webapp. Note that you will also need to include in your webapp any necessary Mule jars:
If you do not need to route calls to Mule supported endpoints and you do not wish to include the Mule JAR dependencies you can use a stripped down version of the servlet JAR, soafaces-services-servlet-nomule.jar that has no mule dependencies or mule support. This will allow you to make UniversalClient calls to endpoints using the soafaces:// protocol only. Steps for setting up your webapp to use the UniversalClient:
Invoking Services Through UniversalClientThis section describes how to use the UniversalClient API and to invoke methods on remote services. The API uses a similar approach as the MuleClient ESB API to send and receive method arguments and return values. For example here one of the simiple : send methods available in UniversalClient: UniversalClient.send(String endpointURI, Object payload, UniversalClientPOJOCallback callback); This send method can invoke Mule endpoints or soafaces endpoints. For example when invoking a soafaces endpoint (using `soafaces://') you are actually invoking a remote method. This method can have zero or more arguments and can return a result (or Void). The UniversalClient send method lets you invoke virtually any method using a simple approach similar to that used by MuleClient. Multiple arguments must be wrapped in an Object[] and passed as the payload. Here are the different options for passing parameters to a method or services using send:
Types of that can be returned from a service call:
Here is a detailed example of how to use the UniversalClient from your GWT application: UniversalClientExample. |
Sign in to add a comment
I have a simple JMS client that acts as a JMS producer sending messages to a JMS queue. I have a simple form field in this servlet into which I enter some value and on clicking submit, that value is stored in the header of the JMS message which is sent to a JMS queue. I wish to have a GWT client instead from where I can send in values from the form field. Is it possible to achieve this using a GWT client?