Announcement

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

    RPCManager.sendRequest params?

    I'm making a sendRequest call with a calback function as such:

    Code:
    isc.RPCManager.sendRequest(
            { callback: "saveCallback()" }
    );
    but I get this error afterwards.
    Code:
    [up-7] ERROR IDACall - Top-level servlet error: 
    java.lang.NullPointerException
    	at com.isomorphic.rpc.RPCDMI.isDMIRequest(RPCDMI.java:60)
    	at com.isomorphic.rpc.RPCRequest.isDMI(RPCRequest.java:114)
    	at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:140)
    	at com.isomorphic.servlet.IDACall.handleRPCRequest(IDACall.java:171)
    	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:102)
    	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:54)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    The callback function is called successfully but I don't want to clog the logs with this error all the time. Is it looking for an additional parameter?

    -d

    #2
    Hello DLeung,

    This could happen if you send a request with no data, so you can avoid it with:

    Code:
    isc.RPCManager.sendRequest(
            { data: {}, callback: "saveCallback()" }
    );
    We'll make sure this parameter is unnecessary in the future. Thanks for the report.

    Comment


      #3
      Now I get an alert Note saying

      Code:
      Received Non-DMI RPCRequest in IDACall - ignorning.  
      To send generic RPCRequests, you should override the 
      actionURL property either on the RPCRequest or globally 
      via RPCManager.actionURL
      Does sendRequest() not work with solely a simple callback function? Do I need to use some other method? Not sure how the request actionURL is called exactly.

      Thanks,

      -d

      Comment


        #4
        Hi DLeung,

        Could you explain what you're trying to do?

        I was assuming that the code you showed before was partial, and that you were in fact specifying actionURL or another property that would make it a meaningful request. If the code you showed before was the complete code, then you are sending an empty request to the default actionURL, which will correctly generate an error because you have not implemented any server-side handling for your custom RPC.

        What did you want to happen?

        Comment


          #5
          It's a save button for a listgrid. If the grid.hasChanges, then it'll do the necessary saves. Regardless, the end action is that it should forward to another page which is what I was trying to accomplish with the sendRequest() callback function. Is this not correct? I'm not entirely sure how the actionURL piece works.

          -d

          Comment


            #6
            So you're trying to point the browser at a different page with that sendRequest() call? That definitely won't work. The RPCManager.sendRequest() mechanism allows you to send data to the server without reloading the top-level page (typically using XMLHttpRequest).

            The actionURL provided to sendRequest() tells the RPCManager which URL this "background" request should go to. If you want to send the user to a different page, you can use the native browser object 'location' like so:

            Code:
            location.href='http://some.other.url';
            Does that help?

            Comment

            Working...
            X