Java – accessing WSDL on Tomcat
I have a web service and I'm deploying it on GlassFish I passed http://localhost:10697/APIService/APIServiceService?wsdl Accessed its WSDL
Now I will migrate the war file to Tomcat 6.0 24, and deploy it But I tried to access its WSDL usage http://localhost:8080/APIService/APIServiceService?wsdl , but I received 404 errors I tried various combinations, but it didn't seem to work
How do I access the WSDL file plz?
Thank you and salute,
Update: Here you are: Web xml:
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <session-config> <session-timeout> 30 </session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
I can't find sun jaxws However... Thank you very much! to greet
Solution
The way WSDL is accessed is not container - specific WS - stack Ws stack in GlassFish is Metro (Metro = jax-ws RI WSIT) Do you install / deploy Metro or jax-ws RI on Tomcat? For steps, see Metro on Tomcat 6 Jax or running jax-ws samples with Tomcat 6 X (jax-ws RI may be sufficient in your case)
Update: you need to be on the web Declare wsservlet in XML (see deploying Metro endpoint):
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <listener> <listener-class> com.sun.xml.ws.transport.http.servlet.WSservletcontextlistener </listener-class> </listener> <servlet> <servlet-name>WebServicePort</servlet-name> <servlet-class> com.sun.xml.ws.transport.http.servlet.WSServlet </servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>WebServicePort</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> <session-config> <session-timeout>60</session-timeout> </session-config> </web-app>
Then in sun jaxws XML (also wrapped in WEB-INF), declare your service endpoint interface (SEI):
<?xml version="1.0" encoding="UTF-8"?> <endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0"> <endpoint name="MyHello" implementation="hello.HelloImpl" url-pattern="/hello" /> </endpoints>
And you can access the WSDL:
http://localhost:8080/<mycontext>/services/hello?wsdl A B C D
>A is the host and port of the servlet container. > B is the name of the war document. > C from the web URL pattern element in XML file. > D from sun jaxws The end of the URL - pattern attribute in the XML file