RequestBuilder and Browser same-origin-policy

282 views
Skip to first unread message

Deepak Singh

unread,
Jul 16, 2012, 1:28:59 PM7/16/12
to google-we...@googlegroups.com

Hi All,

I have a situation as follows,

Environment:  GWT 2.5 , GAE 1.7

I have to make a POST request to 3rd part server which in turn returns XML.
I am doing this with  RequestBuilder but it does not work and return status code 0 and responseText as blank on firefox and fails with an error because of browser same-origin-policy  on IE.

I understand that this is the browser SOP issue.

So How do i overcome this situation ?

I thought to make a RPC call to my own server and then connect with 3rd party server but how it is possible to make a POST request to 3rd party originating from my own server ?


Help appreciated.  



Thanks in advance
Deepak Singh

kim young ill

unread,
Jul 16, 2012, 3:14:00 PM7/16/12
to google-we...@googlegroups.com
you can have a look at apache http-client or if it's simple, just the built-in httpurlConnection of the jdk

hth

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Deepak Singh

unread,
Jul 16, 2012, 3:30:42 PM7/16/12
to google-we...@googlegroups.com
Does anyone of them allow form submission with POST method and get the response without page refresh ?

Thanks
Deepak
--
Deepak Singh

kim young ill

unread,
Jul 16, 2012, 4:57:44 PM7/16/12
to google-we...@googlegroups.com
hmm, not sure if i understand u correctly:

"make a POST request to 3rd party originating from my own server" .

u just need to make a http request to the target host with required params , i asume you do it from server  with jdk, so no dom/js is required, that also means no refresh...

hth

Jens

unread,
Jul 16, 2012, 5:55:31 PM7/16/12
to google-we...@googlegroups.com
Creating a GWT "proxy" service that is accessible under your domain is probably the best you can do. So you would post to your own server and then make a call from your server JVM to the 3rd party server.

-- J.

Deepak Singh

unread,
Jul 17, 2012, 5:06:37 AM7/17/12
to google-we...@googlegroups.com
So how can i create such GWT 'Proxy' ?

On Tue, Jul 17, 2012 at 3:25 AM, Jens <jens.ne...@gmail.com> wrote:
Creating a GWT "proxy" service that is accessible under your domain is probably the best you can do. So you would post to your own server and then make a call from your server JVM to the 3rd party server.

-- J.

--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

kim young ill

unread,
Jul 17, 2012, 5:17:55 AM7/17/12
to google-we...@googlegroups.com
catch the request at your server code (either servlets or rpc-impl, make httpurlconnection to remote host & post the params with it. get result & write back to your client

Joseph Lust

unread,
Jul 17, 2012, 11:13:13 PM7/17/12
to google-we...@googlegroups.com
If you have the flexibility to use GET rather than POST over JSON, the JSONPRequestBuilder is a nice solution to SOP without any proxies. You said you were connecting to a 3rd party domain, so you might want to consider a more RESTful solution than the RPC you mentioned, since that RPC call will be bound to that deployment of your code (that set of .rpc files). With RPC, you'd have to ensure that all RPC code, on all servers, was updated for each release when an RPC changes.

Sincerely,
Jospeh
Reply all
Reply to author
Forward
0 new messages