Hello,

I am using GWT 2.0 and restlet-gwt-2.0rc2 to develop a client that
will
invoke REST web services. The web service accepts a POST request with
a User
object. I followed the example at
http://wiki.restlet.​org/docs_2.0/13-rest​let/21-restlet/318-r​estlet/303-restlet.h​tml
.
The only difference is that the web service will return a response of
type
String. So I am using *Result<String> callback *in the
UserResourceProxy
class (which is similar to ContactResourceProxy class).

However, I get runtime error while trying to load the module in
Eclipse.
Please note that if I using *Result<Void>*  then things are fine but
it is
just that I can't see the response back from the server. The server
(web svc
app) is also running on localhost only, so no need for redirection
etc. Also
note that if I make the same change in the example project
'org.restlet.exa​mple.gae.Serializati​on', I get the same error.
Error is as
follows:

*Errors in 'generated/.....​...../UserResourcePr​oxyProxy.java'*
*Line40: The constructor ObjectRepresentation​<String>(Strin​g,
SerializationStreamFactory) is ambiguous*
*See snapshot: C:\.....\UserResou​rceProxyProxy190521.​.....java*
*
*
*Source code of my app: *
*
*
*1) User.java* - Simple bean kind of class . very similar to
Contact.java in
the example.
*2) UserResource.java *

public interface UserResource {
    @Post
    public void store(User contact);
}

*3) UserResourceProxy.java*

public interface UserResourceProxy extends ClientProxy {
    @Post
    public void store(User user, Result<String> callback);
}

*4) In the GWTClient class that implements EntryPoint interface:*

buttonSubmit.addClic​kHandler(new ClickHandler() {
public void onClick(ClickEvent event) {

                userResource.getClie​ntResource().setRefe​rence(
                        "http://localhost:808​0/webapp/rest/conten​
t1.json");

                userResource.getClie​ntResource().getClie​ntInfo()
                        .getAcceptedMediaTypes().add(
                                new Preference<MediaType>(

 MediaType.APPLICATIO​N_JAVA_OBJECT_GWT));

               * // Create the user object*
                User user = new User();
                user.setId(123);
                user.setName(tbFName​.getValue());

               *// POST the request*
                userResource.store(user, new Result<String>() {
                    public void onFailure(Throwable caught) {
                     System.out.println("Error in submission ");

                    }

                    *// Web service will return response of String
type*
                    public void onSuccess(String v) {
                     System.out.println(​"Success = " + v );

                    }
                });

}
});

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to