Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate java classes from WSDL through java program

I used wsimport command line tool for creating classses but I want to do it from the java code. Any idea?

like image 977
Milan Avatar asked May 09 '26 00:05

Milan


1 Answers

It is possible to call the WsImport main() method:

import com.sun.tools.ws.WsImport;

...

String[] args = {"put", "your", "arguments", "here"};
WsImport.main(args);

I think that this is what the Ant task does.


Update: I'm not sure to understand what you're trying to do (and I don't think that you want to generate source code and compile it during runtime).

If the question is actually about doing dynamic invocation, JAX-WS's dynamic invocation interface (DII) is the javax.xml.ws.Dispatch object. Check JAX-WS's dynamic Dispatch interface.

like image 137
Pascal Thivent Avatar answered May 10 '26 12:05

Pascal Thivent



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!