The proxy creator was using the synchronous parameter names instead of the asynchronous parameter names when serializing the method arguments.

Found by: bobv
Review by: bobv (TBR)

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1551 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java b/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
index d84ab11..415775f 100644
--- a/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
+++ b/user/src/com/google/gwt/user/rebind/rpc/ProxyCreator.java
@@ -265,13 +265,14 @@
           + "\");");
     }
 
-    // Encode the arguments.
+    // Encode all of the arguments to the asynchronous method, but exclude the 
+    // last argument which is the callback instance.
     //
-    for (JParameter param : syncParams) {
-      JType paramType = param.getType();
+    for (int i = 0; i < asyncParams.length - 1; ++i) {
+      JParameter asyncParam = asyncParams[i];
       w.print(streamWriterName + ".");
-      w.print(Shared.getStreamWriteMethodNameFor(paramType));
-      w.println("(" + param.getName() + ");");
+      w.print(Shared.getStreamWriteMethodNameFor(asyncParam.getType()));
+      w.println("(" + asyncParam.getName() + ");");
     }
 
     JParameter callbackParam = asyncParams[asyncParams.length - 1];