Run time error: WebServices with Annotations

Hi all,

Here is my code (HelloImpl.java)

package hellojaxws;

import javax.jws.WebService;

import javax.jws.WebMethod;

@WebService()

public class HelloImpl {

private String msg = "Hello, ";

public void HelloImpl () {}

@WebMethod()

public String sayHello(String name){

return msg + name + "...";

}

}

web.xml

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

<web-app version="2.4"

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://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<listener>

<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>

</listener>

<servlet>

<servlet-name>helloImpl</servlet-name>

<servlet-class>hellojaxws.HelloImpl</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>helloImpl</servlet-name>

<url-pattern>/helloService</url-pattern>

</servlet-mapping>

<session-config>

<session-timeout>60</session-timeout>

</session-config>

</web-app>

sun-jaxws.xml

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

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

<endpoint

name='HelloService'

implementation='hellojaxws.HelloImpl'

url-pattern='/helloService'/>

</endpoints>

Problem

when i given url -http://localhost:8080/WSDemo/helloService?wsdl

the error msg is:

HTTP Status - 404

Message: Servlet helloImpl is not available

how to resolve this problem.

Thanks in advance.

regards

pavan.

[1965 byte] By [PavanKumarGuptaa] at [2007-11-27 11:40:32]
# 1

hi,

finally i found the problem.

in web.xml,

<servlet>

<servlet-name>helloImpl</servlet-name>

<servlet-class>hellojaxws.HelloImpl</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

here, the <servlet-class> has to be given to WSServlet instead of our class,

the modified code is,

<servlet>

<servlet-name>helloImpl</servlet-name>

<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

thanks & tegards

pavan

PavanKumarGuptaa at 2007-7-29 17:32:25 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...