geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
Subject No web.xml for web service still possible? What's its url?
Date Sat, 17 Nov 2007 21:34:18 GMT
Hi,

Created a web app with no web.xml in it. A very simple web service:

package pl.jaceklaskowski.katalog.webservice;

import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService(serviceName = "Katalog")
public class KatalogWS {

    @WebMethod
    public int iloscPozycji(String nazwaKatalogu) {
        return nazwaKatalogu == null ? null : nazwaKatalogu.length();
    }

    @PostConstruct
    void init() {
        Logger.getLogger("katalog").info("Usluga KatalogWS zainicjowana");
    }

    @PreDestroy
    void destroy() {
        Logger.getLogger("katalog").info("Usluga KatalogWS niszczona");
    }
}

and geronimo-web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
    <dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <dep:moduleId>
            <dep:groupId>pl.jaceklaskowski.katalog</dep:groupId>
            <dep:artifactId>katalog-webservice</dep:artifactId>
            <dep:version>1.0</dep:version>
            <dep:type>war</dep:type>
        </dep:moduleId>
    </dep:environment>

    <context-root>/katalog</context-root>

</web-app>

It deployed onto geronimo-2.1-snapshot (jetty) built from tomorrow's trunk.

Q: What's the url of the web service?

When I create 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>Katalog</servlet-name>
        <servlet-class>
            pl.jaceklaskowski.katalog.webservice.KatalogWS
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Katalog</servlet-name>
        <url-pattern>/katalog</url-pattern>
    </servlet-mapping>	
</web-app>

it works fine and http://localhost:8080/katalog/katalog returns "Hi,
this is 'Katalog' web service.", but I can't figure out what's the url
for the service when no web.xml's used. Help appreciated.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Mime
View raw message