Hello guys, I am trying to send xml in POST request in GWT, but no responses or success, see my code below:
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, URL.encode(url)); logger.log(Level.INFO, "Building payload"+builder.toString()); try { builder.setHeader("Content-Type", "application/xml"); builder.setHeader("Accept", "application/xml"); Request response = builder.sendRequest(postData, new RequestCallback() { public void onError(Request request, Throwable exception) { logger.log(Level.INFO, "there was a problem in connecting to the server"); // Couldn't connect to server (could be timeout, SOP violation, etc.) } public void onResponseReceived(Request request, Response response) { if (200 == response.getStatusCode()) { Window.alert("success"+response.getText()); // Process the response in response.getText() logger.log(Level.INFO, "response from the server"+response.getText()); } else { logger.log(Level.INFO, "status is not 200_OK "+response.getText()); // Handle the error. Can get the status text from response.getStatusText() } logger.log(Level.INFO, response.toString()); } }); } catch (RequestException e) { Window.alert("Failed to send the request: " + e.getMessage()); } My post data looks is : <request login="" password="" version="1.0"> <data id="" msisdn="" service-number="" priority="1"> <content type="text/plain">Tes</content> </data> </request> Please advice -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.