You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jacek Laskowski <ja...@laskowski.net.pl> on 2007/11/17 22:34:18 UTC

No web.xml for web service still possible? What's its url?

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

Re: No web.xml for web service still possible? What's its url?

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Nov 18, 2007 10:41 PM, Jarek Gawor <jg...@gmail.com> wrote:
> Jacek,
>
> The web services will be discovered and deployed if the web.xml does
> not exist. If it exists, the information in the web.xml files is used
> to deploy the web services. If the web.xml is essentially empty no web
> services will be deployed.

Yes, you are right now and were right before when I said 'negative'. I
was mistaken. Sorry.

That'd be great if there were a url mapping to map all web services at
once - something like /servlet/* where you can execute servlets
without having to declare them in web.xml. I think /webservices/* or
/services/* would be a nice addition. Possible? So, rather than

   <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>

I wish I could use
/services/pl.jaceklaskowski.katalog.webservice.KatalogWS and execute
the web service.

Jacek

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

Re: No web.xml for web service still possible? What's its url?

Posted by Jarek Gawor <jg...@gmail.com>.
Jacek,

The web services will be discovered and deployed if the web.xml does
not exist. If it exists, the information in the web.xml files is used
to deploy the web services. If the web.xml is essentially empty no web
services will be deployed.

Jarek

On Nov 18, 2007 5:25 AM, Jacek Laskowski <ja...@laskowski.net.pl> wrote:
> On Nov 18, 2007 2:18 AM, Jarek Gawor <jg...@gmail.com> wrote:
>
> > You should see something like the following in the geronimo.log file:
> >
> > INFO: .. Configuring JAX-WS Web Service: <servletName> at <location>.
> >
> > <location> is the url you are looking for. By default the location is
> > /<webAppContext/WebService.serviceName, so I think in your case it
> > should be: /katalog/Katalog
>
> Negative ;-)
>
> jlaskowski@dev /cygdrive/c/geronimo
> $ ./bin/deploy.sh -u system -p manager deploy "C:\Documents and
> Settings\jlaskowski\My
> Documents\NetBeansProjects\katalog\dist\katalog.war"
> Using GERONIMO_BASE:   c:\geronimo
> Using GERONIMO_HOME:   c:\geronimo
> Using GERONIMO_TMPDIR: c:\geronimo\var\temp
> Using JRE_HOME:        c:\apps\java5\jre
>     Deployed pl.jaceklaskowski.katalog/katalog-webservice/1.0/war @
>     /katalog
>
> and at the console nothing's printed out. This is the last line at the
> console, right after the webapp's deployed.
>
> Geronimo startup complete
>
> When I remove web.xml completely (it was empty previously not how I
> described it, i.e. with <web-app /> in it), here's what I couldn't
> undeploy it by issuing redeploy command, so I had to undeploy and
> deploy it again:
>
> jlaskowski@dev /cygdrive/c/geronimo
> $ ./bin/deploy.sh -u system -p manager redeploy "C:\Documents and
> Settings\jlaskowski\My
> Documents\NetBeansProjects\katalog\dist\katalog.war"
> Using GERONIMO_BASE:   c:\geronimo
> Using GERONIMO_HOME:   c:\geronimo
> Using GERONIMO_TMPDIR: c:\geronimo\var\temp
> Using JRE_HOME:        c:\apps\java5\jre
>     No ModuleID or TargetModuleID provided.  Attempting to guess based
>     on the content of the archive.
>     Unable to locate Geronimo deployment plan in archive.  Calculating
>     default ModuleID from archive name.
>     Attempting to use ModuleID 'default/katalog//'
>     Error: default/katalog// does not appear to be a the name of a
>     module available on the selected server. Perhaps it has already been
>     stopped or undeployed?  If you're trying to specify a
>     TargetModuleID, use the syntax TargetName|ModuleName instead. If
>     you're not sure what's running, try the list-modules command.
>
> jlaskowski@dev /cygdrive/c/geronimo
> $ ./bin/deploy.sh -u system -p manager undeploy
> pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
> Using GERONIMO_BASE:   c:\geronimo
> Using GERONIMO_HOME:   c:\geronimo
> Using GERONIMO_TMPDIR: c:\geronimo\var\temp
> Using JRE_HOME:        c:\apps\java5\jre
>     Module pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
>     unloaded.
>     Module pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
>     uninstalled.
>
>     Undeployed pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
>
>
> jlaskowski@dev /cygdrive/c/geronimo
> $ rm -rf repository/pl/jaceklaskowski
>
> jlaskowski@dev /cygdrive/c/geronimo
> $ ./bin/deploy.sh -u system -p manager deploy "C:\Documents and
> Settings\jlaskowski\My
> Documents\NetBeansProjects\katalog\dist\katalog.war"
> Using GERONIMO_BASE:   c:\geronimo
> Using GERONIMO_HOME:   c:\geronimo
> Using GERONIMO_TMPDIR: c:\geronimo\var\temp
> Using JRE_HOME:        c:\apps\java5\jre
>     Deployed pl.jaceklaskowski.katalog/katalog-webservice/1.0/war @
>     /katalog
>
> jlaskowski@dev /cygdrive/c/geronimo
> $ jar -tf "C:\Documents and Settings\jlaskowski\My
> Documents\NetBeansProjects\katalog\dist\katalog.war"
> META-INF/
> META-INF/MANIFEST.MF
> WEB-INF/
> WEB-INF/classes/
> WEB-INF/classes/pl/
> WEB-INF/classes/pl/jaceklaskowski/
> WEB-INF/classes/pl/jaceklaskowski/katalog/
> WEB-INF/classes/pl/jaceklaskowski/katalog/webservice/
> WEB-INF/wsdl/
> WEB-INF/classes/pl/jaceklaskowski/katalog/webservice/KatalogWS.class
> WEB-INF/geronimo-web.xml
> WEB-INF/sun-web.xml
> WEB-INF/web.X.xml
>
> and that's what's printed out on the console:
>
> Geronimo startup complete
> 11:19:53,359 INFO  [DirectoryMonitor] Hot deployer notified that an
> artifact was removed:
> pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
> 11:21:31,171 INFO  [JAXWSServiceBuilder] Configuring JAX-WS Web
> Service: pl.jaceklaskowski.katalog.webservice.KatalogWS at
> /katalog/Katalog
> 11:21:31,515 INFO  [BusApplicationContext] Refreshing
> org.apache.cxf.bus.spring.BusApplicationContext@1c04b2a: display name
> [org.apache.cxf.bus.spring.BusApplicationContext@1c04b2a]; st
> artup date [Sun Nov 18 11:21:31 CET 2007]; root of context hierarchy
> 11:21:31,609 INFO  [XmlBeanDefinitionReader] Loading XML bean
> definitions from class path resource [META-INF/cxf/cxf.xml]
> 11:21:31,703 INFO  [XmlBeanDefinitionReader] Loading XML bean
> definitions from class path resource
> [META-INF/cxf/cxf-extension-geronimo.xml]
> 11:21:31,750 INFO  [DefaultListableBeanFactory] Overriding bean
> definition for bean 'org.apache.cxf.resource.ResourceManager':
> replacing [Root bean: class [org.apache.cxf.bus.resource.R
> esourceManagerImpl]; scope=singleton; abstract=false; lazyInit=false;
> autowireCandidate=true; autowireMode=0; dependencyCheck=0;
> factoryBeanName=null; factoryMethodName=null; initMethod
> Name=null; destroyMethodName=null; defined in class path resource
> [META-INF/cxf/cxf.xml]] with [Root bean: class
> [org.apache.geronimo.cxf.ResourceManager]; scope=singleton;
> abstract=fal
> se; lazyInit=false; autowireCandidate=true; autowireMode=0;
> dependencyCheck=0; factoryBeanName=null; factoryMethodName=null;
> initMethodName=null; destroyMethodName=null; defined in clas
> s path resource [META-INF/cxf/cxf-extension-geronimo.xml]]
> 11:21:31,750 INFO  [XmlBeanDefinitionReader] Loading XML bean
> definitions from class path resource
> [META-INF/cxf/cxf-extension-soap.xml]
> 11:21:31,796 INFO  [XmlBeanDefinitionReader] Loading XML bean
> definitions from class path resource
> [META-INF/cxf/cxf-extension-xml.xml]
> 11:21:31,843 INFO  [XmlBeanDefinitionReader] Loading XML bean
> definitions from class path resource
> [META-INF/cxf/cxf-extension-http.xml]
> 11:21:31,875 INFO  [BusApplicationContext] Bean factory for
> application context
> [org.apache.cxf.bus.spring.BusApplicationContext@1c04b2a]:
> org.springframework.beans.factory.support.Defa
> ultListableBeanFactory@9de5b4
> 11:21:31,984 INFO  [BusApplicationContext] Bean
> 'org.apache.cxf.bus.spring.Jsr250BeanPostProcessor' is not eligible
> for getting processed by all BeanPostProcessors (for example: not eli
> gible for auto-proxying)
> 11:21:31,984 INFO  [BusApplicationContext] Bean
> 'org.apache.cxf.bus.spring.BusExtensionPostProcessor' is not eligible
> for getting processed by all BeanPostProcessors (for example: not e
> ligible for auto-proxying)
> 11:21:31,984 INFO  [DefaultListableBeanFactory] Pre-instantiating
> singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@9de5b4:
> defining beans [cxf,org.apac
> he.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.binding.BindingFactoryManager,org.ap
> ache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.
> WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLife
> CycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalo
> gManager,org.apache.geronimo.cxf.GeronimoDestinationFactory,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.c
> ustomEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAsserti
> onBuilder]; root of factory hierarchy
> 2007-11-18 11:21:33
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
> INFO: Creating Service
> {http://webservice.katalog.jaceklaskowski.pl/}Katalog from class
> pl.jaceklaskowski.katalog.webservice.KatalogWS
> 2007-11-18 11:21:34 pl.jaceklaskowski.katalog.webservice.KatalogWS init
> INFO: Usluga KatalogWS zainicjowana
>
> So, it works only when no web.xml is in the webapp or the following
> mapping's added:
>
>     <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>
>
> When there's web.xml like the following
>
> <?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">
> </web-app>
>
> it doesn't work, i.e. no web services are deployed or they are, but
> can't figure out what their urls are. Should it run fine too?
>
> Thanks Jarek!
>
>
> Jacek
>
> --
> Jacek Laskowski
> http://www.JacekLaskowski.pl
>

Re: No web.xml for web service still possible? What's its url?

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Nov 18, 2007 2:18 AM, Jarek Gawor <jg...@gmail.com> wrote:

> You should see something like the following in the geronimo.log file:
>
> INFO: .. Configuring JAX-WS Web Service: <servletName> at <location>.
>
> <location> is the url you are looking for. By default the location is
> /<webAppContext/WebService.serviceName, so I think in your case it
> should be: /katalog/Katalog

Negative ;-)

jlaskowski@dev /cygdrive/c/geronimo
$ ./bin/deploy.sh -u system -p manager deploy "C:\Documents and
Settings\jlaskowski\My
Documents\NetBeansProjects\katalog\dist\katalog.war"
Using GERONIMO_BASE:   c:\geronimo
Using GERONIMO_HOME:   c:\geronimo
Using GERONIMO_TMPDIR: c:\geronimo\var\temp
Using JRE_HOME:        c:\apps\java5\jre
    Deployed pl.jaceklaskowski.katalog/katalog-webservice/1.0/war @
    /katalog

and at the console nothing's printed out. This is the last line at the
console, right after the webapp's deployed.

Geronimo startup complete

When I remove web.xml completely (it was empty previously not how I
described it, i.e. with <web-app /> in it), here's what I couldn't
undeploy it by issuing redeploy command, so I had to undeploy and
deploy it again:

jlaskowski@dev /cygdrive/c/geronimo
$ ./bin/deploy.sh -u system -p manager redeploy "C:\Documents and
Settings\jlaskowski\My
Documents\NetBeansProjects\katalog\dist\katalog.war"
Using GERONIMO_BASE:   c:\geronimo
Using GERONIMO_HOME:   c:\geronimo
Using GERONIMO_TMPDIR: c:\geronimo\var\temp
Using JRE_HOME:        c:\apps\java5\jre
    No ModuleID or TargetModuleID provided.  Attempting to guess based
    on the content of the archive.
    Unable to locate Geronimo deployment plan in archive.  Calculating
    default ModuleID from archive name.
    Attempting to use ModuleID 'default/katalog//'
    Error: default/katalog// does not appear to be a the name of a
    module available on the selected server. Perhaps it has already been
    stopped or undeployed?  If you're trying to specify a
    TargetModuleID, use the syntax TargetName|ModuleName instead. If
    you're not sure what's running, try the list-modules command.

jlaskowski@dev /cygdrive/c/geronimo
$ ./bin/deploy.sh -u system -p manager undeploy
pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
Using GERONIMO_BASE:   c:\geronimo
Using GERONIMO_HOME:   c:\geronimo
Using GERONIMO_TMPDIR: c:\geronimo\var\temp
Using JRE_HOME:        c:\apps\java5\jre
    Module pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
    unloaded.
    Module pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
    uninstalled.

    Undeployed pl.jaceklaskowski.katalog/katalog-webservice/1.0/war


jlaskowski@dev /cygdrive/c/geronimo
$ rm -rf repository/pl/jaceklaskowski

jlaskowski@dev /cygdrive/c/geronimo
$ ./bin/deploy.sh -u system -p manager deploy "C:\Documents and
Settings\jlaskowski\My
Documents\NetBeansProjects\katalog\dist\katalog.war"
Using GERONIMO_BASE:   c:\geronimo
Using GERONIMO_HOME:   c:\geronimo
Using GERONIMO_TMPDIR: c:\geronimo\var\temp
Using JRE_HOME:        c:\apps\java5\jre
    Deployed pl.jaceklaskowski.katalog/katalog-webservice/1.0/war @
    /katalog

jlaskowski@dev /cygdrive/c/geronimo
$ jar -tf "C:\Documents and Settings\jlaskowski\My
Documents\NetBeansProjects\katalog\dist\katalog.war"
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/pl/
WEB-INF/classes/pl/jaceklaskowski/
WEB-INF/classes/pl/jaceklaskowski/katalog/
WEB-INF/classes/pl/jaceklaskowski/katalog/webservice/
WEB-INF/wsdl/
WEB-INF/classes/pl/jaceklaskowski/katalog/webservice/KatalogWS.class
WEB-INF/geronimo-web.xml
WEB-INF/sun-web.xml
WEB-INF/web.X.xml

and that's what's printed out on the console:

Geronimo startup complete
11:19:53,359 INFO  [DirectoryMonitor] Hot deployer notified that an
artifact was removed:
pl.jaceklaskowski.katalog/katalog-webservice/1.0/war
11:21:31,171 INFO  [JAXWSServiceBuilder] Configuring JAX-WS Web
Service: pl.jaceklaskowski.katalog.webservice.KatalogWS at
/katalog/Katalog
11:21:31,515 INFO  [BusApplicationContext] Refreshing
org.apache.cxf.bus.spring.BusApplicationContext@1c04b2a: display name
[org.apache.cxf.bus.spring.BusApplicationContext@1c04b2a]; st
artup date [Sun Nov 18 11:21:31 CET 2007]; root of context hierarchy
11:21:31,609 INFO  [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource [META-INF/cxf/cxf.xml]
11:21:31,703 INFO  [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource
[META-INF/cxf/cxf-extension-geronimo.xml]
11:21:31,750 INFO  [DefaultListableBeanFactory] Overriding bean
definition for bean 'org.apache.cxf.resource.ResourceManager':
replacing [Root bean: class [org.apache.cxf.bus.resource.R
esourceManagerImpl]; scope=singleton; abstract=false; lazyInit=false;
autowireCandidate=true; autowireMode=0; dependencyCheck=0;
factoryBeanName=null; factoryMethodName=null; initMethod
Name=null; destroyMethodName=null; defined in class path resource
[META-INF/cxf/cxf.xml]] with [Root bean: class
[org.apache.geronimo.cxf.ResourceManager]; scope=singleton;
abstract=fal
se; lazyInit=false; autowireCandidate=true; autowireMode=0;
dependencyCheck=0; factoryBeanName=null; factoryMethodName=null;
initMethodName=null; destroyMethodName=null; defined in clas
s path resource [META-INF/cxf/cxf-extension-geronimo.xml]]
11:21:31,750 INFO  [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource
[META-INF/cxf/cxf-extension-soap.xml]
11:21:31,796 INFO  [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource
[META-INF/cxf/cxf-extension-xml.xml]
11:21:31,843 INFO  [XmlBeanDefinitionReader] Loading XML bean
definitions from class path resource
[META-INF/cxf/cxf-extension-http.xml]
11:21:31,875 INFO  [BusApplicationContext] Bean factory for
application context
[org.apache.cxf.bus.spring.BusApplicationContext@1c04b2a]:
org.springframework.beans.factory.support.Defa
ultListableBeanFactory@9de5b4
11:21:31,984 INFO  [BusApplicationContext] Bean
'org.apache.cxf.bus.spring.Jsr250BeanPostProcessor' is not eligible
for getting processed by all BeanPostProcessors (for example: not eli
gible for auto-proxying)
11:21:31,984 INFO  [BusApplicationContext] Bean
'org.apache.cxf.bus.spring.BusExtensionPostProcessor' is not eligible
for getting processed by all BeanPostProcessors (for example: not e
ligible for auto-proxying)
11:21:31,984 INFO  [DefaultListableBeanFactory] Pre-instantiating
singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@9de5b4:
defining beans [cxf,org.apac
he.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.binding.BindingFactoryManager,org.ap
ache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.
WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLife
CycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalo
gManager,org.apache.geronimo.cxf.GeronimoDestinationFactory,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.c
ustomEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAsserti
onBuilder]; root of factory hierarchy
2007-11-18 11:21:33
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service
{http://webservice.katalog.jaceklaskowski.pl/}Katalog from class
pl.jaceklaskowski.katalog.webservice.KatalogWS
2007-11-18 11:21:34 pl.jaceklaskowski.katalog.webservice.KatalogWS init
INFO: Usluga KatalogWS zainicjowana

So, it works only when no web.xml is in the webapp or the following
mapping's added:

    <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>

When there's web.xml like the following

<?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">
</web-app>

it doesn't work, i.e. no web services are deployed or they are, but
can't figure out what their urls are. Should it run fine too?

Thanks Jarek!

Jacek

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

Re: No web.xml for web service still possible? What's its url?

Posted by Jarek Gawor <jg...@gmail.com>.
Jacek,

You should see something like the following in the geronimo.log file:

INFO: .. Configuring JAX-WS Web Service: <servletName> at <location>.

<location> is the url you are looking for. By default the location is
/<webAppContext/WebService.serviceName, so I think in your case it
should be: /katalog/Katalog

Jarek

On Nov 17, 2007 4:34 PM, Jacek Laskowski <ja...@laskowski.net.pl> wrote:
> 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
>