aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Deploying JAX-WS Webservice on glassfish AppServer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Deploying JAX-WS Webservice on glassfish AppServer" Watch "Deploying JAX-WS Webservice on glassfish AppServer" New topic
Author

Deploying JAX-WS Webservice on glassfish AppServer

Sanjay Singh
Ranch Hand

Joined: Mar 02, 2006
Posts: 37

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?

Regards, Sanjay Singh
SCJP-1.6, OCEWCD 6
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1733
    
  25

What is the context root of you web-application?

Regards,
Frits
Sanjay Singh
Ranch Hand

Joined: Mar 02, 2006
Posts: 37

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
Bartender

Joined: Apr 07, 2010
Posts: 1733
    
  25

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

Joined: Mar 02, 2006
Posts: 37

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
Bartender

Joined: Apr 07, 2010
Posts: 1733
    
  25

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

Joined: Mar 02, 2006
Posts: 37

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deploying JAX-WS Webservice on glassfish AppServer