Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate equals() and hashcode() methods using wsimport in jaxws

Tags:

jaxb

jax-ws

The generated classes from my WSDL using wsimport are not having equals() and hashcode() methods. How can I customize and generate the client classes to get equals() and hashcode() methods.

I am not sure about using JAXB to achieve this.

In Axis2.0 generated stubs these methods are generated but not sure why such a basic thing is not available in JAXWS!

like image 386
kiri Avatar asked Jun 29 '11 15:06

kiri


People also ask

How do I generate stubs in Wsimport?

You can run wsimport command from any directory where you like to generate stubs. We have published a sample soap web service which we going to use in this example. You can use this sample service URL https://test.java4coding.com/core/service/service.php?wsdl to test the wsimport command.

What does wsimport do?

The wsimport command-line tool processes an existing Web Services Description Language (WSDL) file and generates the required artifacts for developing Java™ API for XML-Based Web Services (JAX-WS) web service applications.

What tool can you use to parse an existing WSDL file and generate files required to access web services?

The wsimport tool is used to parse an existing Web Services Description Language (WSDL) file and generate required files (JAX-WS portable artifacts) for web service client to access the published web services. This wsimport tool is available in the $JDK/bin folder.


1 Answers

You can use the JAXB2 Basics Plugin to generate equals() and hashcode() methods:

  • https://github.com/highsource/jaxb2-basics
  • http://confluence.highsource.org/display/J2B/JAXB2+Basics+Plugins
like image 70
bdoughan Avatar answered Oct 14 '22 16:10

bdoughan