2
votes

I'm a newbie in web services with jax-ws and I'm a little mixed up with the different files. I'm doing a simple hello test and I'm trying to explain something.

I successfully installed my web service on Glassfish. I also tested it with a standalone javaoutside the server) My example comes from the helloservice in the javaee5 tutorial examples. (http://java.sun.com/javaee/5/docs/tutorial/doc/docinfo.html)

In the web.xml, I have this section:

...
    <servlet-mapping>
        <servlet-name>HelloService</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>
...

in sun-jaxws.xml

...
    <endpoint
        name='HelloService'
        implementation='helloservice.endpoint.Hello'
        url-pattern='/hello'/>
...

and in the sun-web.xml:

...
  <context-root>/helloservice</context-root>
...

I see that the context root specified in the web.xml is the same as the one in sun-jaxws.xml.

  1. The context root in sun-web.xml, does it matter or is it only used in a EAR file ?

  2. I can access my wsdl file from 2 different addresses: http://localhost:8080/helloservice/hello?wsdl http://localhost:8080/helloservice/HelloService?wsdl I can't explain the second one. Where does it come from ? Is it a configuration of the endpoint address ? How come we can access the web service both ways (by context-root and by Service name)? Please explain to me

Thanks

1

1 Answers

0
votes

You can configure the url to your service in many ways, in your project you have it defined in 3 different places, most of the times define something in more than one place is not a good idea.
Because you have defined 2 diffrent paths to your service, one for jax-ws and another one for the sun-web (glassfish config file), you end up with to definitions to the same service.