This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

on Tproblem while deploying web omcat + JWSDP 1.5

 
Raghuveer Rawat
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi WebService Experts
I have developed a very simple web service with JWSDP 1.5 and trying to deploy on tomcat50-jwsdp app server(JWSDP1.5 integrated Tomcat app server).
I am trying for JAX-RPC Service Endpoint and for this I have written following files:
/WEB-INF
/WEB-INF/web.xml
/WEB-INF/webservices.xml
/WEB-INF/mapping.xml
/WEB-INF/classes/math/MathFace.class
/WEB-INF/classes/math/MathImpl.class
/WEB-INF/wsdl/MathService.wsdl

and all these files have been packaged in math.war

Full source code for all these file is as follows:
web.xml
<?xml version="1.0" encoding='UTF-8'?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<servlet>
<servlet-name>MathService</servlet-name>
<servlet-class>math.MathImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MathService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file/>
</welcome-file-list>

</web-app>

webservices.xml
<?xml version='1.0' encoding='UTF-8'?>
<webservices
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
version="1.1">

<webservice-description>
<webservice-description-name>MathService</webservice-description-name>
<wsdl-file>/WEB-INF/wsdl/MathService.wsdl</wsdl-file>
<jaxrpc-mapping-file>/WEB-INF/mapping.xml</jaxrpc-mapping-file>
<port-component>
<port-component-name>MathService</port-component-name>
<wsdl-port>MathFacePort</wsdl-port>
<service-endpoint-interface>math.MathFace
</service-endpoint-interface>
<service-impl-bean>
<servlet-link>MathService</servlet-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>

mapping.xml
<?xml version="1.0" encoding="UTF-8"?>
<java-wsdl-mapping version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
<package-mapping>
<package-type>math</package-type>
<namespaceURI>urn:Foo</namespaceURI>
</package-mapping>
<package-mapping>
<package-type>math</package-type>
<namespaceURI>urn:Foo</namespaceURI>
</package-mapping>
<service-interface-mapping>
<service-interface>math.MathService</service-interface>
<wsdl-service-name xmlns:serviceNS="urn:Foo">serviceNS:MathService</wsdl-service-name>
<port-mapping>
<port-name>MathFacePort</port-name>
<java-port-name>MathFacePort</java-port-name>
</port-mapping>
</service-interface-mapping>
<service-endpoint-interface-mapping>
<service-endpoint-interface>math.MathFace</service-endpoint-interface>
<wsdl-port-type xmlns ortTypeNS="urn:Foo">portTypeNS:MathFace</wsdl-port-type>
<wsdl-binding xmlns:bindingNS="urn:Foo">bindingNS:MathFaceBinding</wsdl-binding>
<service-endpoint-method-mapping>
<java-method-name>add</java-method-name>
<wsdl-operation>add</wsdl-operation>
<method-param-parts-mapping>
<param-position>0</param-position>
<param-type>int</param-type>
<wsdl-message-mapping>
<wsdl-message xmlns:wsdlMsgNS="urn:Foo">wsdlMsgNS:MathFace_add</wsdl-message>
<wsdl-message-part-name>int_1</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
</method-param-parts-mapping>
<method-param-parts-mapping>
<param-position>1</param-position>
<param-type>int</param-type>
<wsdl-message-mapping>
<wsdl-message xmlns:wsdlMsgNS="urn:Foo">wsdlMsgNS:MathFace_add</wsdl-message>
<wsdl-message-part-name>int_2</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
</method-param-parts-mapping>
<wsdl-return-value-mapping>
<method-return-value>int</method-return-value>
<wsdl-message xmlns:wsdlMsgNS="urn:Foo">wsdlMsgNS:MathFace_addResponse</wsdl-message>
<wsdl-message-part-name>result</wsdl-message-part-name>
</wsdl-return-value-mapping>
</service-endpoint-method-mapping>
</service-endpoint-interface-mapping>
</java-wsdl-mapping>

MathService.wsdl
<?xml version="1.0" encoding="UTF-8"?>

<definitions name="MathService" targetNamespace="urn:Foo" xmlns:tns="urn:Foo" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types/>
<message name="MathFace_add">
<part name="int_1" type="xsd:int"/>
<part name="int_2" type="xsd:int"/></message>
<message name="MathFace_addResponse">
<part name="result" type="xsd:int"/></message>
<portType name="MathFacePort">
<operation name="add" parameterOrder="int_1 int_2">
<input message="tns:MathFace_add"/>
<output message="tns:MathFace_addResponse"/>
</operation>
</portType>
<binding name="MathFaceBinding" type="tns:MathFace">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
<operation name="add">
<soap peration soapAction=""/>
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="urn:Foo"/></input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="urn:Foo"/></output></operation></binding>
<service name="MathService">
<port name="MathFacePort" binding="tns:MathFaceBinding">
<soap:address location="http://127.0.0.1:8080/math/MathService"/>
</port>
</service>
</definitions>

math.MathFace.java Interface

package math;

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface MathFace extends Remote {
public int add(int a, int b) throws RemoteException;
}


math.MathImpl.java Implementation class

package math;

import java.rmi.RemoteException;

public class MathImpl implements MathFace {
public int add(int a, int b) throws RemoteException {
return a + b;
}
}


After deploying the application when I am trying to access the application using http://localhost:8080/math/MathService, It is giving error message that math.MathImpl is not a servlet.

What I read from books is for JAX-RPC Service Endpoint our Java implementation class(math.MathImpl) acts as a servlet then why I am getting this error.
Is there anyone who have faced this problem earlier? Don't know how to solve this problem.

Any help please...

Thanks in advance for spending time on this problem...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic