Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Here we will have a look on how to create a plain old java client for consuming the web service.

Developing the Client

  • Create a Java Project
    • Select File->New->Project

    • In the popup window select Java->Java Project and then click Next

    • Name the project as jaxws-converterpojoclient and click Finish in the New Java Project dialog.

  • Copy the files Converter.java and ConverterPortType.java into the appropriate package.

  • Add another class with the name ConverterClient.java in the same package.

  • Add the following code to the ConverterClient.java

...

This completes the development section of our POJO client

Adding necessary jar files to the class path

Note
titleErrors in Java Project

Now our Java project might show many errors and even if we resolve the errors the application may not run properly. This is due to the missing jar files required to access and understand SOAP messages sent by web service.

...

Tip
titleJRE 6

If you are running Java 6 you don't need to worry about the external JARs as they are all inbuilt into JRE 6. But you should copy all the files generated by wsimport command into appropriate packages as Runtime Modeller in Java 6 is slightly different.

Testing

  1. Now Right click the ConverterClient.class and select Run As->Run as Java Application

  2. Now enter the amount in the console window of Eclipse
  3. The output will be shown which is retrieved by accessing the methods of Web service.

...