Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Given a WSDL file, create a simple Java client

Can anyone please provide me with a sample code for this? I have a wsdl file, and I want to create a client that will call a service from that wsdl file
A working code with some explanation will be really helpful.

I'm using JDK 1.4.

like image 556
oneiros Avatar asked Dec 01 '11 16:12

oneiros


People also ask

How do I create a WSDL client in Java?

Generate the client code as follows: In the Project Explorer, right-click your client project's WSDL file, and then select WebLogic Web Services > Generate Web Service Client from the drop-down menu, as Figure 1 shows. This will open the New Web Service Client dialog that Figure 2 shows.

How is WSDL file generated in Java?

Create a WSDL descriptor from Java code Select the desired class name in the editor. In the main menu, go to Tools | XML WebServices and WSDL | Generate WSDL From Java Code. In the Generate WSDL From Java dialog that opens, specify the following: The name and URL address of the Web service.


2 Answers

The main options are to use:

  1. JAX-WS, using the wsimport tool.
  2. Apache AXIS2, using wsdl2java.

Both links provide code examples. Some searching on the web will get you even farther. There are also options for creating dynamic SOAP clients but the generated ones are easiest.

like image 91
maerics Avatar answered Nov 09 '22 10:11

maerics


Eclipse is having the option to generate java client.
Just Right click on the WSDL file
Generate Web Service Client
Thatz all. You get the client to invoke the SOAP Service

like image 41
Karthik M Avatar answered Nov 09 '22 10:11

Karthik M