开发者

Generate java classes from WSDL through java program

开发者 https://www.devze.com 2022-12-23 16:26 出处:网络
I u开发者_如何转开发sed wsimport command line tool for creating classses but I want to do it from the java code. Any idea?It is possible to call the WsImport main() method:

I u开发者_如何转开发sed wsimport command line tool for creating classses but I want to do it from the java code. Any idea?


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.


What you are trying to achieve is not typical Java Web Services flow. But you can achieve this with dynamic JVM based Groovy language using GroovyWS module.


You can use the wsimport ant task programatically.

You can do this by using the task class - com.sun.tools.ws.ant.WsImport. Instantiate it, set its properties (as defined on the task documentation), and call the execute() method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号