Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RPCRequest.setHttpMethod("PUT") doesn not submit parameters?

    Hello
    I'm using following code to submit RPC request using PUT method. It does not seem to send the parameters:

    Code:
    RPCRequest req = new RPCRequest();			
    		HashMap<String,String> data = new HashMap<String,String>();
    		data.put("comments", "TEST-GWT"); // <- never shows up in the servlet			
    		
    		req.setParams(data);
    		req.setEvalResult(false);
    		req.setHttpMethod("PUT");
    		req.setActionURL("/app/customers");
    		req.setUseSimpleHttp(true);
    RPCCallback callback = new RPCCallback() {...}
    RPCManager.sendRequest(req, callback);
    However, simply changing PUT to POST makes the parameter 'comments' to show up in the Servlet.
    Can someone point me in the right direction. Thanks.

    #2
    Try setData() instead of setParams().

    Comment


      #3
      Using setData instead of setParams generates this message:
      Code:
      WARN:Comm:Non-string data object passed to sendXML as request.data:{comments: "TEST-GWT"} attempting to convert to a string.
      I'm not sure why it's trying to convert to XML instead of sending as Request Body. Anyway flag I'm missing on RPCRequest object?

      Comment


        #4
        Sorry. Didn't catch the use of a map for the data. The "data" must be a string when useSimpleHttp is true because RPC doesn't know how you want the data serialized. You will need to do that first.

        If you are using XML or JSON you can use a DataSource instead and still use PUT instead of POST.

        Comment

        Working...
        X