On the server side I want to know how to access data used in an RPCRequest from SmartGwt.
Here is the SmartGwt client code:
private void update() {
RPCRequest request = new RPCRequest();
request.setData("RPC text from client");
request.setActionURL("/Empi-MT/resources/empi/update");
request.setContentType("text/xml");
RPCManager.sendRequest(request,
new RPCCallback() {
public void execute(RPCResponse response, Object obj, RPCRequest request) {
SC.say("Response from the server:" + obj);
}
});
}
Here is the RESTful java server code .
@POST
@Consumes("text/xml")
@Produces("text/xml")
@Path("/update")
public String update() {
return "We got to here";
}
This trivial code works fine, but now I need to know how to access the data that was put into the RPCRequest. How do I do that in the server code?
Thanks,
You look like you may be heading in the wrong direction; if this "update" operation is a CRUD operation on some object, you want to using DataSources - take a look at the QuickStart overview of Data Integration, focusing on RestDataSource.
http://www.smartclient.com/releases/SmartGWT_Quick_Start_Guide.pdf
Also you seem to be starting down the road of using generated REST services, this is almost always wrong - see this FAQ:
http://forums.smartclient.com/showthread.php?t=8159#aExistingRest
Finally if this really is not a CRUD operation, you want to set useSimpleHttp on the RPCRequest, and then the docs for this property explain the different ways data can be sent.