• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deploying JAX-WS Webservice on glassfish AppServer

 
Ranch Hand
Posts: 37
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to deploy the JAX-WS Webservice on glassfish as given in the up & running example. I created the simple webservice with with @WebService annotation and packaged it as WAR and deployed in glassfish. I can see that it got deployed successfully but when I try to access the wsdl url, as mentioned in the book, it doesn't come up. It gives resource not found error. The example code:


If I add web.xml and sun-jaxws.xml with the WAR and configure it as following then I am able to access the wsdl:
web.xml:



sun-jaxws.xml:

Now I can access the wsdl using: http://localhost:8080/webservice2/team?wsdl. As per the book the Metro, bundled with glassfish, will automatically generate all the dependent class files, which we generate using wsgen, and also webservice.xml & sun-jaxws.xml which doesn't seems to be happening. Do I need to do some customization to make it happen automatically with providing my own custom web.xml & sun-jaxws.xml?
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the context root of you web-application?

Regards,
Frits
 
Sanjay Singh
Ranch Hand
Posts: 37
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frist,
The context root of my web-app is "webservice2" (have deployed as webservice2.war in glassfish). When I try to access the WSDL for Teams service (as mentioned in below code) with URL http://localhost:8080/webservice2/TeamsService?wsdl, it doesn't come up and gives 404 error.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The context root of my web-app is "webservice2"


Did you check your console? It should have a message like:

INFO: WEB0671: Loading application [webservice2] at [/webservice2]



If you see that message, then the URL of the wsdl should be:
http://localhost:8080/webservice2/team?wsdl

Regards,
Frits
 
Sanjay Singh
Ranch Hand
Posts: 37
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frist,
I checked the console and I can see the message as you mentioned:

[2013-10-14T19:36:07.904+0530] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=82 _ThreadName=AutoDeployer] [timeMillis: 1381759567904] [levelValue: 800] [[ Loading application [webservice2] at [/webservice2]]]



But as I had mentioned in my previous msg that I can access the wsdl with url http://localhost:8080/webservice2/team?wsdl only when I have web.xml & sun-jaxws.xml configured. But let's say I only bundle the Teams class in a WAR and deploy then will glassfish will be able to deploy it as a webservice automatically as mentioned in the Java Webservice Up & Running book. The book says we can access with URL: http://localhost:8080/webservice2/TeamsService?wsdl which I am not able to access it after deploying without any deployment files.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, now you should look at your console again and look for the line like this:

INFO: WS00018: Webservice Endpoint deployed
Teams listening at address at http://localhost:8080/TeamServerWeb/TeamsService



When you have located it, you can add ?wsdl to it http://localhost:8080/TeamServerWeb/TeamsService?wsdl and you will be fine.

Note that my dynamic web project is called TeamServerWeb that is why the context-root is different from yours.

Regards,
Frits
 
Sanjay Singh
Ranch Hand
Posts: 37
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Frits,
Today again I deployed the war and it worked. I can see the wsdl & tester URL for the deployed war. Not sure what was the problem with earlier deployment as I haven't done any code or config changes.
Thanks for your help and prompt reply.
Note: I am using the glassfish 4.0.

Regards,
Sanjay
 
reply
    Bookmark Topic Watch Topic
  • New Topic