Generating Single WSDL file for Multiple classes

99封情书 提交于 2019-12-13 14:01:49

问题


We are using "Bottom Up" approach for building webservices. We have 10 java classes which we want to expose as a webservice. How can we create only one WSDL file for these classes? (java2wsdl utility & its Ant task takes only one class as parameter for generating WSDL file.)


回答1:


I am not sure if you will find any tool which could take multiple java classes and generate one WSDL for them. You could generate WSDLs for each service and then combine them manually by copying the relevany vomplex types and service operations in 1 WSDL and then your SOAP servlet could identify these operations and call relevant service classes.

I hope someone can tell a cleaner approach for this as the one I am suggesting is definitely not the best way.




回答2:


Definitely not the right way of doing it, by default all the tools assume they are exposing a single service.

There is one thing you can try if you are using Jax-WS(Metro or Axis2 or CXF) try creating a interface and let all these classes implement that interface and all the methods (operations) you want expose as part of the web service, and use @WebService with this interface as the value of "endpointInterface".




回答3:


One approach I can think of, simillar to what @shivaspk has proposed is "Create an interface and declare the methods for functionalities of your underlying classes. Generate WSDL for this interface. In the implementation of that interface you can call the underlying class in corresponding method."



来源:https://stackoverflow.com/questions/2459301/generating-single-wsdl-file-for-multiple-classes

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