I will answer my own question and pose another.
Initially, I took the sample Calculator service and client and ran them on Glassfish and they worked perfectly. When I changed the build to Tomcat it broke down.
First problem was that while Glassfish had the jaxws libraries in it tomcat 6 did not. First I added them to the Service but later I found it was better to add them to the $CATALINA_HOME/lib directory and remove them from the service.
The other problem was the annotations. My client could not find the context.
public CalculatorWSService service;
[b] @Resource[/b]
protected WebServiceContext context;
I forgot to remove this one annotation and that was causing the problem.
Now on to the next set of problems. the xml config files. It seems that Tomcat 6 likes things a bit different and I have not been able to figure this out yet. Right not the client can not find the endpoint.
Service 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">
<display-name>CalculatorApp</display-name>
<listener>
<listener-class>org.me.calculator.CalculatorWS</listener-class>
</listener>
<servlet>
<servlet-name>CalculatorWSService</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CalculatorWSService</servlet-name>
<url-pattern>/CalculatorWS</url-pattern>
</servlet-mapping>
<service-ref>
<service-ref-name>CalculatorApp/CalculatorWSService</service-ref-name>
<service-interface>javax.xml.ws.Service</service-interface>
<wsdl-file>/WEB-INF/wsdl/CalculatorWSService.wsdl</wsdl-file>
</service-ref>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Service sun-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN"
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/CalculatorApp</context-root>
<servlet>
<servlet-name>CalculatorAppServlet</servlet-name>
<webservice-endpoint>
<port-component-name>CalculatorWSService</port-component-name>
<endpoint-address-uri>/CalculatorApp/CalculatorWSService</endpoint-address-uri>
<transport-guarantee>NONE</transport-guarantee>
</webservice-endpoint>
</servlet>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
<endpoint implementation="org.me.calculator" name="CalculatorWSService" url-pattern="/CalculatorWS"/>
</endpoints>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
<webservice-description>
<webservice-description-name>CalculatorApp</webservice-description-name>
<wsdl-publish-location>/WEB-INF/wsdl</wsdl-publish-location>
</webservice-description>
</sun-web-app>
client 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">
<servlet>
<servlet-name>ClientServlet</servlet-name>
<servlet-class>org.me.calculator.client.ClientServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ClientServlet</servlet-name>
<url-pattern>/ClientServlet</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<service-ref>
<service-ref-name>CalculatorApp/CalculatorWSService</service-ref-name>
<service-interface>javax.xml.ws.Service</service-interface>
<wsdl-file>/WEB-INF/wsdl/CalculatorWSService.wsdl</wsdl-file>
</service-ref>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
client sun-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN"
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/CalculatorClientApp</context-root>
<servlet>
<servlet-name>ClientServlet</servlet-name>
</servlet>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>
WSDL
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.4-b01-. -->
<definitions targetNamespace="http://calculator.me.org/" name="CalculatorWSService"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://calculator.me.org/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema>
<!-- <xsd:import namespace="http://calculator.me.org/" schemaLocation="CalculatorWSService_schema1.xsd"/>-->
<xsd:element name="multiply" type="tns:multiply"/>
<xsd:element name="multiplyResponse" type="tns:multiplyResponse"/>
<xsd:complexType name="multiply">
<xsd:sequence>
<xsd:element name="i" type="xs:int"/>
<xsd:element name="j" type="xs:int"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="multiplyResponse">
<xsd:sequence>
<xsd:element name="return" type="xs:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="multiply">
<part name="parameters" element="tns:multiply"/>
</message>
<message name="multiplyResponse">
<part name="parameters" element="tns:multiplyResponse"/>
</message>
<portType name="CalculatorWS">
<operation name="multiply">
<input message="tns:multiply"/>
<output message="tns:multiplyResponse"/>
</operation>
</portType>
<binding name="CalculatorWSPortBinding" type="tns:CalculatorWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="multiply">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="CalculatorWSService">
<port name="CalculatorWSPort" binding="tns:CalculatorWSPortBinding">
<soap:address location="http://localhost:8080/CalculatorApp/CalculatorWSService"/>
</port>
</service>
</definitions>
Message was edited by: jebricker
|