You must use a proxy mechanism on server side to redirect the call to appropriate domain. Take a look here, it may help you resolve the problem using ProxyServlet: http://code.google.com/p/acris/wiki/SeparateClientAndServer
On 23. Feb, 16:03 h., ramesh chiluveri <chiluveri...@gmail.com> wrote: > Hai All, > > I am trying to develop an application ,which will going to make > server calls from different domains. I am facing problem with SOP . I > am not able to make a sever call from different doamin. > > Below is the my code. > When i make rpc call with this code,it is always failing.(onFailure) > > import java.util.ArrayList; > import java.util.HashMap; > > import com.google.gwt.core.client.EntryPoint; > import com.google.gwt.core.client.GWT; > import com.google.gwt.core.client.JavaScriptObject; > import com.google.gwt.http.client.RequestBuilder; > > import com.google.gwt.user.client.Window; > import com.google.gwt.user.client.rpc.AsyncCallback; > import com.google.gwt.user.client.ui.Button; > import com.google.gwt.user.client.ui.ClickListener; > import com.google.gwt.user.client.ui.RootPanel; > import com.google.gwt.user.client.ui.Widget; > > /** > * Entry point classes define <code>onModuleLoad()</code>. > */ > public class invoxwidget implements EntryPoint,ClickListener{ > > public static String userSharedId = ""; > > protected HashMap callbacks = new HashMap(); > protected HashMap scriptTags = new HashMap(); > protected int curIndex = 0; > public Button but = null; > public void onModuleLoad() { > > String serverURL = GWT.getModuleBaseURL()+"?callback="; > String callbackName = reserveCallback(); > setup(this, callbackName); > addScript(callbackName, serverURL + callbackName); > > } > > public String reserveCallback() > { > while (true) > { > if (!callbacks.containsKey(new Integer(curIndex))) > { > callbacks.put(new Integer(curIndex), null); > > return "__gwt_callback" + curIndex++; > } > } > } > > /** > * <p>Adds the JSONP script to our widget so we can make XSS > requests baby</p> > * > * @param uniqueId The unique id of the call > * @param url The URL of our Request > */ > public native void addScript(String id, String url) > /*-{ > > var elem = document.createElement("script"); > elem.setAttribute("language", "JavaScript"); > elem.setAttribute("src", url); > elem.setAttribute("id", id); > document.getElementsByTagName("body")[0].appendChild(elem); > }-*/; > > public void handle(JavaScriptObject jso) > { > > if( jso != null ) > { > > HashMap details = new HashMap(); > details.put("userSharedID",userSharedId); > Window.alert("before ContactServer "+userSharedId); > > ContactServer.Util.getInstance().getBusinessName(details,new > AsyncCallback(){ > > public void onFailure(Throwable arg0) { > > Window.alert("In onFailure"); > > } > public void onSuccess(Object arg0) { > Window.alert("In onSuccess"); > } > }); > > /** > * > * <p>Sets up our Javascript cross site JSON call</p> > * > * @param model Handles our Cross Site JSON call > * @param callback > */ > public native static void setup(invoxwidget inv, String callback) > /*-{ > > $wnd.__gwt_callback0 = function(someData) > { > alert("inside setup"); > i...@com.mantra.invoxwidget.client.invoxwidget::handle(Lcom/ > google/gwt/core/client/JavaScriptObject;)(someData); > } > }-*/; > > } > > I am not able to find what is wrong?? > > Please help me > > Thanks > Ramesh -- 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-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.