For non-GWT clients, you will need to create additional servlets that produce XML or JSON instead of GWT-RPC.
/dmc
On Mon, Jan 31, 2011 at 2:21 AM, George H <george.dma@gmail.com> wrote:
bump :S
On Fri, Jan 28, 2011 at 1:41 PM, George.H <george.dma@gmail.com> wrote:
> Hi,
>
> I have a GWT application running and it contains several servlets. Our
> regular clients use a GWT client to access the servlets. We have some
> new clients that need to access the same servlets but via a very
> minimal client. Like plain javascript using ajax rpc call to retrieve
> the data.
>
> Problem I am getting is when creating the ajax rpc call using JQuery,
> I can't seem to do the following.
>
> 1. Get the "strong name" to add in the X-GWT-Permutation request
> header
> 2. The gwt-rpc data format to send to the servlet
>
> When I intercept an RPC call via firebug I see the data being sent
> back and forth looks somewhat like this
> '6|0|9|http://127.0.0.1:8888/company/|9C9DC9A25F67541F626CF723FEE3A6B2|
> com.company.mobile.client.login.service.LoginService|login|
> java.lang.String/2004016611|testUser|testPass|authcode|LOGINSRV|1|2|3|
> 4|4|5|5|5|5|6|7|8|9|'
>
> As 1 long string.
>
> So I have an ajax call like so (using the string) This actually works
> and invokes the servlet's Login method but for some reason the "error:
> function()" get executed after the callback.
>
> $(document).ready(function() {
>
> $("a").click(function(e) {
>
> e.preventDefault();
>
> $.ajax({
>
> type: 'POST',
>
> url: 'http://127.0.0.1:8888/company/login',
>
> contentType: 'text/x-gwt-rpc; charset=utf-8',
>
> data: ('6|0|9|http://127.0.0.1:8888/company/|
> 9C9DC9A25F67541F626CF723FEE3A6B2|
> com.company.mobile.client.login.service.LoginService|login|
> java.lang.String/2004016611|testUser|testPass|authcode|LOGINSRV|1|2|3|
> 4|4|5|5|5|5|6|7|8|9|'),
>
> beforeSend: function(xhr) {
>
> xhr.setRequestHeader('X-GWT-Permutation', 'HostedMode');
>
> xhr.setRequestHeader('X-GWT-Module-Base','http://127.0.0.1:8888/
> company/');
>
> },
>
> dataType:
>
> success: function(data2){
>
> alert("Success");
>
> alert(data2);
>
> },
>
>
>
> error: function(data3) {
>
> alert("Error");
>
> alert(data3);
>
> }
>
> });
>
> });
>
> });
>
> Has anyone done something like this before? How can I prepare my data
> to be sent to the servlet via gwt-rpc and generate a proper X-GWT-
> Permutation string?
>
> thanks in advance to anyone who can help.
--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
--
David Chandler
Developer Programs Engineer, Google Web Toolkit
w: http://code.google.com/
b: http://googlewebtoolkit.blogspot.com/
t: @googledevtools
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment