Generate WSDL from java class\source

假如想象 提交于 2019-12-17 16:28:20

问题


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 ?


回答1:


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).




回答2:


Axis2 is another alternative, specifically the java2wsdl command/plugin




回答3:


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



来源:https://stackoverflow.com/questions/1666714/generate-wsdl-from-java-class-source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!