aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes How to access GlassFish's web service testing facility Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "How to access GlassFish Watch "How to access GlassFish New topic
Author

How to access GlassFish's web service testing facility

Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
In the section 4.7 of Ivan Kriz's tutorial one statement says that:
"After having been deployed, the calculator service can be tested using the GlassFish's web service testing facility"

Can anyone please explain this further on how to access this testing facility. I deployed the service but I don't see any testing facility in the GlassFish admin console.

Note: I am using GlassFish version 3.1


SCJP,SCWCD, SCDJWS
Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
Hi there,

When you are in the admin console, you will see in the tree on your left, Applications. There you have all your web and ejb apps deployed in that domain. Click on the one you deployed the web service port components. You will see a menu Edit Application. Below there is a grid Modules and Components. Click on the link View Endpoint. There you will have a description of your Web Service, plus two links Tester and Wsdl. Click on Tester and bingo!!! Now you can test your web service and see the in/out soap messages. Note that glassfish testing facility will not work when your using security in your web services.
Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
Hi Deriko,
I don't see the link - View Endpoint. Please check attachment.

I noticed that an exception occurs whenever I start the domain:


Is this is a show stopper here ?

Note: My machine name is 'deepak_krv' and that what appears in the URL.


[Thumbnail for Admin_Console.jpg]

Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
Hi there, The link is exactly on a row below the third row in your grid, see the attachment . You are not seeing it, because your web app was not correctly deployed because of this exception. I googled about it and it seems to be a problem with the '_' of your machine name, try changing the name.



[Thumbnail for webservices.png]

Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
The link is still not visible ...
Please refer to the attachment.
I have changed my system name to - DeepakValechha. The exception which I was getting earlier is resolved now.

In the log I also see the messages:


The following is the WSDL:


Ivan Kriz's tutorial says that:
"When deploying a web service with a WSDL to GlassFish, the address of the web service will automatically be entered into the WSDL by the container" hence I have left the string REPLACE_WITH_ACTUAL_URL as it is hoping that GlassFish is taking care of it by inserting the address. Not sure if this is the issue.

Please help ...


[Download Admin_Console.tif] Download

Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
Hi,
Your web app was deployed correctly, but your web service not. This happened due to a problem with one of your port components(wsdl, sib, jaxb artifacts). It seems your wsdl is ok, and there is no problem with REPLACE_WITH_ACTUAL_URL( It is ,indeed, replaced by glassfish). How is your SIB? It´s easy to you discover where is the problem. You can remove the parameter wsdlLocation = "CalculatorService.wsdl" in your @WebService annotation, to check if the problem is the wsdl. You can remove all annotations on your SIB(including above the methods) leaving only the @WebService with no parameters, as the easist way to deploy a web service in a app server is to deploy only a SIB annotated with @WebService, all other configurations are optional on the simplest cases. Also you can delete the Jaxb artifacts to verify if there is a problem to them, as they are generated in runtime if not provided(Note you will have to remove any annotations referring to them in the SIB).
Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
Hi Deriko,
One question before I do the debugging as you have suggested. Do I have create two different projects here? One a Web Project (Holding the Service Implementation) and another a Web Service project ?

Right now I have only created one Web Project and I am trying to deploy it as a Web Service. Not sure if this is correct.
Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
Yes that´s correct, you only need one Web project holding the service implementation. When you deploy it, it becomes automatically a web service. When I said
Your web app was deployed correctly, but your web service not.
I meant your web app is working correctly, but it didn´t recognize the service implementation as a web service, that´s why in glassfish admin console you see the launch link but you don´t see the view endpoint one. Sorry if I didn´t make myself clear.
Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
Deriko,
You were clear in the first place itself. I just asked just to make sure I am not missing something.
This thing is eating up my time. Anyway, I am yet to try out the debugging as you have suggested. I will see how it goes and keep you updated.
Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
Still no luck after doing the debugging steps you have mentioned.
I also uninstalled Glass Fish V3 and deployed the application on V2.1. There I see that my application has been deployed as a Web Application only and not as a Web Service.

Deriko, could you please tell me the steps you performed to deploy the application ?

The way I am doing it is as mentioned in the tutorials:
"We are now ready to deploy and run the calculator web service. No changes are required to the
default web application deployment descriptor files (web.xml and sun-web.xml).
In Eclipse, the project can be deployed using Run As → Run on Server. GlassFish will
automatically recognize and deploy the web service."

Please see attached screen-shot which shows my directory structure and the generated wsgen artifacts.

Note: The current structure was generated after removing all annotations from the class. The only annotation I kept was the @WebService annotation.
Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
Sorry, missed the attachment in the last post. This issue is freaking me out ....


[Download Admin_Console.TIF] Download

Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
Hi, I´m using glassfish 3 too. There isn´t anything wrong with your directory structure, you could have provided the sun-web.xml file(But It is not required). I´m following the steps of Ivan Kriz's tutorial. Also in section 8.3- "Servlet Based Web Service", there is an example of a simpler web service. Try it. I´m following these steps using eclipse:

1) Create a dinamic web project
see webservices1 att.

2) Provide the SIB
see webservices2 att.

3) Run the glassfish


Note I´m using glassfish runtime libraries.
Are you sure you´re not missing any exception in the log?


[Thumbnail for webservices1.png]

[Thumbnail for webservices2.png]

Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
And it has finally worked. Somehow example 8.3 worked. Not sure what wrong I was doing earlier. Will look into it latter. For the moment I will cherish the moment ..
Deriko, I thank you from the bottom of my heart for all the help and patience you showed.
Thanks.
Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
You are welcome. I´m glad I was able to help.
;)
Regards.
Kumar Sonu
Ranch Hand

Joined: Apr 05, 2011
Posts: 36
I have found the problem why the CalculatorWebService (in section 4.7) was not getting deployed.

When I create a Dynamic Web Project in eclipse galileo, the default web.xml file looked like this:


Now the example in Ivan's study guide has the web.xml as:


The difference I see is the version numbers. As a result of this version difference my service was not getting deployed.

Any idea why this would happen ?
Deriko Prata
Greenhorn

Joined: Dec 16, 2010
Posts: 21
I think maybe the metro´s release that comes with glassfish needs version 2.5 of web app xml schema to deploy automatically a servlet endpoint.
I tested with version 2.4 and it really didn´t work. But when I mapped the WSServlet(and provided the sun-jaxws.xml) , it worked fine with version 2.4.
I also tried deploying in tomcat 7 mapping the WSServlet and it worked too(To deploy a web service in tomcat, you will need at least JAX-WS 2.1).
But this is just speculation, to really know what happened, you will need to look in glassfish documentation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access GlassFish's web service testing facility