问题
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