unsafe_where_true
unsafe_where_true

Reputation: 6300

gwt: making remote calls fails - sop?

I am writing some interface for users to collect data and send to a server. I went for GWT for various reasons.

Now, when I try to call my server:

String url = "http://127.0.0.1:3000/data/collection.xml";
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url));

Request request = builder.sendRequest(data, new RequestCallback() {     

        public void onResponseReceived(Request request, Response response) {

              if (200 == response.getStatusCode()) {
                  result.setText("SUCCESS!");
              } else {
                  result.setText("ERROR with code: " + response.getStatusCode());

My server gets the request (a POST with some data) but I get ERROR with code: 0 (!) all the time. I guess this has to do with SOP. I read lots about this SOP but I am even more confused now. I tried to follow this tutorial but that's using a different approach (I managed to adapt it to issue GET calls only, but return objects are always null).

Can anyone point me into the right direction? thanks

Upvotes: 1

Views: 345

Answers (1)

Gursel Koca
Gursel Koca

Reputation: 21280

You can not call any service from another server because of SOP. What you can do, you can use your original server as proxy to other servers.. I would recommend you to read this tutorial.

Upvotes: 2

Related Questions