I have a WSDL file (or, more precisely, its URL). I need to convert it to Java classes. I also need to provide tests for the web service it describes. I\'m new to web servi
The Eclipse team with The Open University have prepared the following document, which includes creating proxy classes with tests. It might be what you are looking for.
http://www.eclipse.org/webtools/community/education/web/t320/Generating_a_client_from_WSDL.pdf
Everything is included in the Dynamic Web Project template.
In the project create a Web Service Client. This starts a wizard that has you point out a wsdl url and creates the client with tests for you.
The user guide (targeted at indigo though) for this task is found at http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jst.ws.cxf.doc.user%2Ftasks%2Fcreate_client.html.
Using command prompt in windows you can use below command to get class files.
wsimport "complete file path of your .wsdl file"
example : wsimport C:\Users\schemas\com\myprofile\myprofile2019.wsdl
if you want to generate source code you should be using below commnad.
wsimport -keep -s src "complete file path of your .wsdl file"
example : wsimport -keep -s src C:\Users\schemas\com\myprofile\myprofile2019.wsdl
Note : Here "-s" means source directory and "src" is name of folder that should be created before executing this command. Wsimport is a tool which is bundled along with JAVA SE, no seperate download is required.
Options are:
Read through the above links before taking a call
I wouldn't suggest using the Eclipse tool to generate the WS Client because I had bad experience with it:
I am not really sure if this matters but I had to consume a WS written in .NET. When I used the Eclipse's "New Web Service Client" tool it generated the Java classes using Axis (version 1.x) which as you can check is old (last version from 2006). There is a newer version though that is has some major changes but Eclipse doesn't use it.
Why the old version of Axis matters you'll say? Because when using OpenJDK you can run into some problems like missing cryptography algorithms in OpenJDK that are presented in the Oracle's JDK and some libraries like this one depend on them.
So I just used the wsimport tool and ended my headaches.
You need to do next in command line:
wsimport -keep -s (name of folder where you want to store generated code) urlToWsdl
for example:
wsimport -keep -s C://NewFolder https://www.blablabla.com
In Eclipse Kepler it is very easy to generate Web Service Client classes,You can achieve this by following steps .
RightClick on any Project->Create New Other ->Web Services->Web Service Client->Then paste the wsdl url(or location) in Service Definition->Next->Finish
You will see the generated classes are inside your src folder.
NOTE :Without eclipse also you can generate client classes from wsdl file by using wsimport command utility which ships with JDK.
refer this link Create Web service client using wsdl