aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Calling WebService using plain JavaScript Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Calling WebService using plain JavaScript" Watch "Calling WebService using plain JavaScript" New topic
Author

Calling WebService using plain JavaScript

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
I need to call a WebService of a different domain from my application using plain JavaScript. I don’t have a liberty to use any JavaScript/Ajax libraries - I can only use plain JavaScript.

Solution must work on IE and Firefox both.



My blood is tested +ve for Java.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35253
    
    7
Since XmlHttpRequest falls under the same-domain policy, you'll have to use JSONP.


Android appsImageJ pluginsJava web charts
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 576

Wouldn't the web service need to support JSONP? If yes - it sounds like a good approach - otherwise traditional server proxy approach would work.

I found this an interesting read.


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 576

In case its not clear by what I meant by a server proxy -- you'll find some good help here -- http://www.google.com/search?q=cross+domain+javascript&ie=utf-8&oe=utf-8&aq=t
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Calling WebService using plain JavaScript
 
Similar Threads
Getting response values in a text box
Stuck using AJAX & WebService
GWT Error+ XFire Webservice
Struts with Ajax
Showing Hiding <s:div> tag in Struts2