3

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

2
  • 1
    Could you say why do you need this? Commented Mar 23, 2010 at 9:36
  • 1
    cause I need to make dynamic service invoker based on the WSDL. So I need dynamic creating of web service classes Commented Mar 23, 2010 at 9:38

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I've been trying to understand what he's trying to do for a while, and I finally I came to the conclusion that he wants something like soapclient.com/soaptest.html
0

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.

Comments

0

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.

1 Comment

I cant see how I can execute wsimport from java

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.