How to get the URL of my WSDL?

点点圈 提交于 2020-02-21 13:03:33

问题


I have created a very simple web service using Netbeans, Java EE6, JAX-WS and TomCat. It just have one @WebMethod getWsdlURL(), which is supposed to return the URL of my wsdl, and it should be something similar to:

http://192.168.70.44:8088/SimpleWebService/WebService?wsdl

However I don't have any idea on how to do that.

Can anyone help me?


回答1:


Don't add your own service to return the URL. Depend on the runtime, that already supplies it.

Just open the url in a browser. The url would be....

http://<hostname>:<port>/<webappname>/<servletEndpoint>?wsdl



回答2:


To add to answer of david99world, you can look for the endpoint url-pattern in sun-jaxws.xml configuration file present in WEB-INF dir.

The file may have a definition like:

<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">

    <endpoint name="ws/MyService" implementation="com.test.ws.services.MyService"
        url-pattern="/ws/MyService" enable-mtom="false" />

</endpoints>



回答3:


If you are generating classes from a WSDL when you build, your service class will extend javax.xml.ws.Service and therefore will inherit the getWSDLDocumentLocation method.



来源:https://stackoverflow.com/questions/19180607/how-to-get-the-url-of-my-wsdl

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