2

In my effort to create a webservice that can be deployed on glassfish and tomcat, I noticed that both AS will give a different URL to the WSDL. For the attached code at the end of this post I had: Glassfish v3: localhost:8080/TaxCalculator/TaxCalculatorService?wsdl Tomcat 6.23: localhost:8080/TaxCalculator/TaxCalculator?wsdl Both worked fine using soapUI, but I don't want this AS dependency which implies some endPointUrl.

Now, I tried to fix this based on the information I found here. Never the less the information didn't comply with the way Tomcat and GlassFish deal with this information. So this didn't help and now Tomcat is not generating the WSDL anymore. At least, I couldn't find it using the expected combination (is there an overview somewhere?) Logging of Tomcat does not reveil any problems.

Is there any proper documentation on how to set the endpointUrl such that: - The latter part of the endpointUrl will be the same on both GlassFish, Tomcat and any other commonly used AS? - Setting an endpoint url without hardcoding the hostname.

Or does any one see what I am doing wrong? The webservice implementation defines a endpointInterface, serviceName and portName. (I defined the WS in Java using the JAX-WS annotations).

Below the xml configurations:

web.xml: <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">
<display-name>TaxCalculator</display-name>
<!-- Tomcat workaround -->
<listener>
    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
    <servlet-name>TaxCalculatorService</servlet-name>
    <!-- Tomcat workaround -->
    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>TaxCalculatorService</servlet-name>
    <url-pattern>/TaxCalculator</url-pattern>
</servlet-mapping>
<session-config>
    <session-timeout>
        30
    </session-timeout>
</session-config>

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

content.xml: <Context antiJARLocking="true" path="/TaxCalculator"/>
Community
  • 1
  • 1
Pim
  • 21
  • 2

1 Answers1

0

I think if you change

<servlet-mapping>
    <servlet-name>TaxCalculatorService</servlet-name>
    <url-pattern>/TaxCalculator</url-pattern>
</servlet-mapping>

to

<servlet-mapping>
    <servlet-name>TaxCalculatorService</servlet-name>
    <url-pattern>/TaxCalculatorService</url-pattern> <!-- changed -->
</servlet-mapping>

then tomcat will create the url: localhost:8080/TaxCalculator/TaxCalculatorService?wsdl

lpinto.eu
  • 2,077
  • 4
  • 21
  • 45