I have a xml document I need to send to a remote server that isn't mine.
I have the url and port number for the remote server, and I've tried to implement the transfer using RequestBuilder.
Code Example:
RequestBuilder req= new RequestBuilder(RequestBuilder.POST, URL.encode(url));
req.setHeader("Content-Type", "application/x-www-form-urlencoded");
Request response =
req.sendRequest(message, new RequestCallback() {
public void onError(Request request, Throwable exception) {
exception.printStackTrace();
}
public void onResponseReceived(Request request, Response response){
System.err.println(response.getText());
}
});
} catch (RequestException e) {
Window.alert("Failed to send the request: " + e.getMessage());
}
If this isn't the way to do it, it would be greatly appreciated if anyone could explain what must be done.
Btw the error I'm getting is:
Failed to send the request: The URL www.test.net:8909 is invalid or violates the same-origin security restriction