so here is my problem.
I’m using wsdl2java tool, to transform my web services into Java API.
The thing is, when I generate java stubs, my code contains something like that:
public void function(com.xxxxx.ssssss.Myclass myclass){...}
My question is:
how to remove this part “com.xxxxx.sssss.” from the whole code, and put it in import section, and all that, not manually, because it would be too long.
Thank you
The vast majority of those classes shouldn’t ever be edited at all; just generate them from the WSDL and leave them well alone. Yes, they’ll be verbose but you’ll just have to live with that (or offer to work on a better code generator for the CXF project, of course!)
The one class that you can edit is the skeleton (
…Impl.java) that is generated with the-imploption. In fact, that’s the source file that you should edit as it will contain the implementation logic for the service, which is your job. You generate it once and can change it however you want thereafter provided you implement the correct interface and have the right annotations. In particular, using refactoring tools to generateimportdeclarations is perfectly fine (I find that this is easy to do in Eclipse; I’d be startled if other Java IDEs didn’t also support something similar).The only real fly in the ointment comes if you start altering the original WSDL significantly. While adding and removing methods is not too hard to deal with, the bigger the change the more work it is to support. You may have to look carefully at whether the service skeleton should be regenerated from scratch, but that will cost you all your changes; if you’re expecting to be doing that a lot, it’s a good idea to factor out much of the actual implementation of the service into worker classes so that you only need to rebuild the actual connection to the SOAP service. (Luckily, using Spring DI makes this sort of factorization really easy to manage, so much so that it’s a good idea to use it anyway.)