Related Entries

Remove duplicate jars
Simple MongoDB+Java example
Lightweight JSP development environments
jEdit with jGoodies
Jython is great

« Birthday Bash
» JDeveloper 10g - lighter!

JDeveloper for WS client development

Newbie notes on how developing a Google consumer using JDeveloper.

If you go for a Visual Studio.NET demo, chances are that the speaker will try to impress you with its prowess when it comes to building web services clients (also called as consumers). Once you are impressed, the next slide will most certainly be about lack of such tools in the Java world. To a certain extent that is true, but in the context of web service consumers, Oracle JDeveloper is just as easy as VS.NET.

This is a small write-up that is aimed at helping you to like JDeveloper, by writing a client for Google web services. Once you have the software installed, you can see that it wouldn’t even take 5 minutes to have a working client.


  1. Register and get Google API.
  2. Download Oracle JDeveloper 10g preview edition.

Install JDeveloper

  1. Extract it to say, c:\jdev905\. Let us call this location as JDEVHOME now onwards. One of the good things about JDeveloper is that it is installed like good old DOS programs! Just extract it.
  2. Start JDeveloper by running JDEVHOME\jdev\bin\jdevw.exe.

JDeveloper Setup

  1. In JDeveloper, files are grouped into Projects, which in turn are grouped into Application Workspaces. If you are familiar with VS.NET, think of Workspaces as equivalents of Solutions.
  2. Let us create a new application workspace, by
    File->New->General->Application Workspace
    Name it as WebServices.
  3. On the left side, you can see a Applications-Navigator docked pane. Double click on Applications node in that to expand the view. You will see the new workspace -WebServices- you created, under it.
  4. Right click on WebServices to create a new project called google.

Develop Client

  1. First step is to generate stubs using the WSDL file. This is similar to creating proxies in .NET using wsdl.exe. Or, in VS.NET terms, this is identical to adding a Web Reference to the project.
    • Right-click on the project and choose New->Web Services->...Stubs.
    • A wizard starts.
    • If you had extracted the Google API, you should see a WSDL file in that folder. Use this file in the dialog.
    • In the next screen, choose to generate a main method. Normally, you shouldn’t do this, but it keeps things simplified for this exercise.
    • Several files will be created for you:
      • - this is the proxy client that interacts with Google’s services.
      • - a class that implements a Google data type.
      • - a class that implements Google search result data type; containing a list of ResultElements.
      • - a class that implements a single Google search result element.
  2. Examine
    • In main, you will see a line called //Add your code here.
    • Add a line below that like: System.out.println(stub.doSpellingSuggestion(your_google_key_here, "mircosotf dot nut"));
    • In the Run menu, choose Run
    • It should return microsoft dot net.

Viola! There is your simple Google client in no time. Let us try to make this better.

Next Steps

My personal preference is never to edit the generated stub. Generally, I avoid modifying generated code. This makes it much easier to work on the code you need to write, without worrying about auto-generated code.

If you examine the stub code, you will see that all calls to Google (doSpellingSuggestion, doGetCachedPage and doGoogleSearch) have your Google key as the first argument. Here’s my suggested improvement:

If you prefer, download this zip archive that has my project files - remember to use your own Google key in and to set JDeveloper home in build.xml! Still better would be to define Google key in a properties file. I’m leaving that as an exercise.


JDeveloper is fine, you might want to build the code using Ant. Before you start making an Ant file, right-click on project google and:

New->Ant file-> From existing project file

The default build.xml created by JDeveloper shows that the CLASSPATH is quite large. Nevertheless, if you plan to indulge in Web Services development, many of these packages are what you will need for every project. Perhaps, it is not that much of a pain then!

Note: I realize screenshots would’ve made these notes easier to read ;-)

Update 10/27/2003: A good month after this blog entry was published, Oracle has authored their own how to develop Google consumer using jDeveloper 10g :-) That is presented as an article, with screenshots - they use Google services to make their own JSP client.

  1. Thanks for the notes.. will surely come in handy when I jump on the webservices bandwagon.

    Posted by: Srijith on September 28, 2003 09:45 PM
  2. Hi ,

    I am getting the following error.
    Any Proxy settings or bypass proxy code will do...

    [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:

    <HEAD><TITLE>Firewall Error: Forbidden</TITLE></HEAD>



    You are not permitted to access the remote system.


    If this is an error, then you should contact your local firewall




    at org.apache.soap.rpc.Call.getEnvelopeString(

    at org.apache.soap.rpc.Call.invoke(

    at webservices.GoogleSearchServiceStub.doSpellingSuggestion(

    at webservices.GoogleSearchServiceStub.main(

    Posted by: Joy Bhowmick on October 16, 2003 05:35 AM
  3. Please refer Jdeveloper help:

    Search in help for:
    "When the Proxy Server Requires Authentication"
    Do the following:
    (in Jdeveloper 10g)

    When you create the stub in wizard check the "Generate Basic Proxy Authentication Code"
    It generates the following part of the code:
    Properties props = new Properties();
    props.put(OracleSOAPHTTPConnection.PROXY_AUTH_TYPE, "basic");
    props.put(OracleSOAPHTTPConnection.PROXY_USERNAME, "proxy_username");
    props.put(OracleSOAPHTTPConnection.PROXY_PASSWORD, "proxy_password");
    props.put(OracleSOAPHTTPConnection.PROXY_HOST, "");
    props.put(OracleSOAPHTTPConnection.PROXY_PORT, "80");

    Change your proxy_username and proxy_password.

    (My company uses the windows network username and password for proxy authentication.)

    Kind regards


    Posted by: Otto Bertalan on October 22, 2003 01:58 AM
  4. Even by adding authentication, I am getting the below error...

    [SOAPException: faultCode=SOAP-ENV:IOException; msg=ModuleException thrown by HTTPClient while getting the response.HTTPClient.AuthSchemeNotImplException: Negotiate; ModuleException thrown by HTTPClient while getting the response.HTTPClient.AuthSchemeNotImplException: Negotiate]

    at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(

    at org.apache.soap.rpc.Call.invoke(

    at mypackage1.SMSStub.SSG_IVR_CheckDEL(

    at mypackage1.SSGClient.main(

    Posted by: Thiru on January 28, 2004 10:14 PM
  5. Sres. Oracle:
    SOlicito muy comedidamente, me ayuden con el siguiente error:

    invalid request URI '/soap/servlet/soaprouter'

    Posted by: Ma ISabel Masache on March 5, 2004 12:55 AM
  6. i have this error whenever i try to test my webservice in jdeveloper, any one knows?

    [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Unsupported response content type "text/html", must be: "text/xml". Response was:


    Posted by: javier mendoza on March 10, 2004 08:00 AM
  7. Hi,

    When calling a web service from an applet, i get this exception:

    java.lang.ExceptionInInitializerError: access denied (java.util.PropertyPermission * read,write)

    when trying to execute 'm_httpConnection = new OracleSOAPHTTPConnection();' in the stub...

    I don't think there is any security constraint about that...
    What may be the reason?

    Posted by: MrBlonde on April 29, 2004 12:25 AM
  8. Hi
    I am getting this exception when trying to using webservices from java client
    however if i use lan connection i am not getting this exception.I am getting this exception at the time of dial up only.
    Please help me
    Manish Poddar
    [SOAPException: faultCode=SOAP-ENV:IOException; msg=Connection timed out: connect; Connection timed out: connect]

    at org.apache.soap.SOAPException.(

    at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(

    at org.apache.soap.rpc.Call.invoke(

    Posted by: Manish Poddar on April 30, 2004 06:03 PM
  9. Estoy consumiendo un webservice desde Jdeveloper y me presenta el siguiente error, alguien tiene idea de que pueda ser???????

    [SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a ':DatosSalida' using encoding style ''.; targetException=java.lang.IllegalArgumentException: No Deserializer found to deserialize a ':DatosSalida' using encoding style ''.]


    Posted by: Yobany on July 14, 2004 04:43 AM