Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Use a Java Applet to access remote Web services

JavaFAQ Home » Java Applets Go to all tips in Java Applets


Bookmark and Share

In this article, I show you how to create a system that uses your browser to request and interact with Web service data from an arbitrary source. First, I create the basic applet, then I create the JavaScript code that pulls the data into the Web page. Finally, I create a servlet that acts as a proxy for non-local requests.

This article assumes that you are familiar with Java technology and (to a lesser extent) with XML. In addition to a Java development environment such as J2SE 1.4 or above, you'll need several pieces of software for this article. To send and receive the SOAP messages, you'll need the SOAP with Attachments Application Program Interface (API) for Java, or SAAJ (see "Send and receive SOAP messages with SAAJ" for help in setting it up) and you'll need a servlet engine such as IBM® WebSphere® Application Server or Apache Tomcat to run the servlet. See Resources for links to the various software packages you'll need.

A simple request
First, take a look at the request you're ultimately going to make from the applet. Although this technique works for any kind of data you can pass through a URL, this article focuses on Web services, so I'll start with the simple SOAP message in Listing 1.

Applets have always been designed to play in a "sandbox" in which they can't hurt anything on a user's system, so their security is tighter than that of their server-based application counterparts. But what if you want an applet that can make arbitrary Web requests? This article shows you how to work around this problem by building a server-based proxy. It also shows you how to use JavaScript code to access applet-based information.
 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy