12

I have a package with "logic" classes(like CheckAuthenticationDataLogic.java, GetVocabulariesLogic.java). And another class - ApiService.java is used to generate wsdl. ApiService.java is full of methods like this:

/**
   * Check authentication data.
   * @param contractNumber - number of contract.
   * @param msisdn - msisdn.
   * @param superPassword - super password.
   * @return result of authentication.
   */
  @WebMethod
  @WebResult(name = "result")
  public CheckAuthenticationDataResult checkAuthenticationData(@WebParam(name = "contractNumber")
                                                               final String contractNumber,
                                                               @WebParam(name = "msisdn")
                                                               final String msisdn,
                                                               @WebParam(name = "superPassword")
                                                               final String superPassword) {
    return runLogic(new CheckAuthenticationDataLogic(contractNumber, msisdn, superPassword));
  }

As you see it's just a proxy methods... So i want to avoid doing same work twice and generate WSDL right from logic classes without writing ApiService.java. Any tool or library for this purpose exists ?

3 Answers 3

19

The wsgen tool generates JAX-WS portable artifacts used in JAX-WS web services. Note that you do not have to generate WSDL at the development time as JAXWS runtime will automatically generate a WSDL for you when you deploy your service.

You might want to check the JAX-WS RI documentation and especially the samples (pay a special attention to the fromjava sample).

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

3 Comments

i have an error "Exception in thread "main" java.lang.NoClassDefFoundError" and it occurs because this class is placed not in the classpath but in remote library(libraries are placed just in another folder). How can i include this libraries to my classpath ?
wsgen -wsdl:Xsoap1.2 -extension -d testGen -cp /home/vidocq/workspace/ws-crp/build/output/eclipse-classes com.crp.logic.CheckAuthenticationDataLogic
What error do you get when running wsgen with -cp? Please update your question with details on your project configuration (where are sources located) and the trace.
3

Axis2 is another alternative, specifically the java2wsdl command/plugin

Comments

0

The Metro (http://metro.java.net/) web service stack provides a tool (wsgen) to generate WSDL from annotated Java.

3 Comments

You don't need Metro (Metro = JAX-WS RI + WSIT/Tango), you only need JAX-WS RI which is included in Java 6. So if you are using Java 6, you actually don't need anything.
@Pascal Thivent: You are absolutely right. Though, I think that Metro is usually more up-to-date than the JAX-WS RI provided by JSE.
Well, the JDK 6 Update release 14 has JAX-WS 2.1.6 RI which is pretty decent. But indeed, Metro 1.5 includes JAX-WS 2.1.7 (which is considered as a minor release, see weblogs.java.net/blog/2009/04/21/jax-ws-ri-217metro-15-released). However, if you want to use JAX-WS RI 2.1.7, you can download it from jax-ws.dev.java.net, you still don't need Metro. But honestly, I wouldn't bother playing with the endorsed directory mechanism.

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.