RequestBuilder classes can only be used on the client side. The exception you are getting is essentially telling you 'You cannot use this class on the server side'.
To make a GET/POST request from your server code is actually simple and doesn't have anything to do with GWT. You can use the standard java.net.URL class. public void myRPCMethod() { URL url = new URL(" http://www.services.dynmark.com/HttpServices/SendMessage.ashx?"); InputStream in = url.openStream(); //Read from the InputStream // Extract information from XML and return necessary data } If you want more options/control, you should use the Apache HttpClient library http://hc.apache.org/httpclient-3.x/tutorial.html --Sri 2009/9/13 John V Denley <johnvden...@googlemail.com> > > Please excuse the newbie wording below, Im really not sure how to > phrase this problem correctly, which is of course causing me problems > with trying to find a solution by searching online, as I dont really > know what it is that i need to do, but I think its an "HTTP POST" (but > it could be send/get/submit/request?! as Ive seen all these terms used > when hunting around for a solution!) > > Ive looked around as much as I can though and as is often the case > cant seem to find any working examples of what I need to do which is > to call a 3rd party website via an HTTP call from the server side of > my GWT/GAE application. > > Essentially the following code snippet does the job on the client side > (ive changed the parameters to protect confidentiality): > > String SendText="http://www.services.dynmark.com/ > HttpServices/SendMessage.ashx<http://www.services.dynmark.com/%0AHttpServices/SendMessage.ashx>?" > + > "user=username" + > "&password=password" + > "&to=447765111222"+ > "&from=447765222111" + > "&text=MESSAGE_TEXT"; > Anchor SendMessageLink = new Anchor("Send Message"); > SendMessageLink.setHref(SendText); > RootPanel.get().add(SendMessageLink); > > when the user clicks on the link though, it takes them to an XML > result page with a reference number embedded. > > Obviously i dont want that to happen, i need to capture the reference > number so I can then make a different HTTP request to get the status, > and I dont want the user to see the HTTP text (password) or to be > redirected to another website. > > Ive then tried to use the Requestbuilder function (class/widget?) of > GWT, but thats when I run into the same origin policy security > restriction (http://en.wikipedia.org/wiki/Same_origin_policy) > > Reading around on the internet, it seems that the only way to achieve > what I need is to run the HTTP post from the server after an RPC > conection. I have tried to implement this, but have found no working > examples to figure out how to achieve this. I have tried to simple > copy and paste the Requestbuilder code into my server functions, only > to have the following error appear on the eclipse console: > > "Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create > () is only usable in client code! It cannot be called, for example, > from server code." > > If anyone can give me some help and advice on this topic, then I would > be very greatful! > > Thanks, > John > > > --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---