In Glassfish 2, the admin console had a separate node for web services.
Once there you could click on one of the services a get this page
Notice the “Test” button. That will take you to a page that will allow you to test all of your service operations. Handy. But in Glassfish 3, there is no node for web services. I was dismayed when I found this. How will I test my service on the server? No worries. It’s still there. It’s just moved, and it takes a few more clicks.
Click on the Applications node and navigate to the web application that contains the web service you want to test. You’ll find this page detailing the application and it’s modules.
You’ll notice that under the action column you see two rows with links for View Endpoint. When you click on that link, you will find the link for testing your service. It’s the same page as in Glassfish 2. It looks like this.
The result of running your operation is a display of both the SOAP Request and the SOAP Response.
This testing mechanism in Glassfish is invaluable. Take advantage of it.
For an in depth read on web services in Glassfish, check out Java expert Aran Gupta’s article Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse
1.) Add the mime type to the the domain’s default-web.xml (ex. domains/domain1/config/default-web.xml)
2.) Restart the domain
3.) Redeploy the web application where the file related to the new mime type is being served.
Sound simple? It is simple! But it took me a week to figure this out! The documentation is flaky on this subject. First, I just tried the Help in the Admin Console. I searched mime. Nothing. So I tried the documentation. In the Developer’s Guide, I found this:
Using the default-web.xml File
You can use the default-web.xml file to define features such as filters and security constraints that apply to all web applications.
The mime-mapping elements in default-web.xml are global and inherited by all web applications. You can override these mappings or define your own using mime-mapping elements in your web application’s web.xml file. For more information about mime-mapping elements, see the Servlet specification.
You can use the Admin Console to edit the default-web.xml file. For details, click the Help button in the Admin Console. As an alternative, you can edit the file directly using the following steps.
To Use the default-web.xml File
- Place the JAR file for the filter, security constraint, or other feature in the domain-dir/lib directory.
- Edit the domain-dir/config/default-web.xml file to refer to the JAR file.
- Restart the server.
From this, I gathered 2 important facts:
1.) I can add a global mime type to default-web.xml
2.) I will probably need to start the server
On the glassfish forum, I gathered that for default-web.xml changes to take effect, the application that needs them requires a redeployment. Great! No problem…didn’t work.I was overlooking a small detail. I redeployed the wrong application. I redeployed that application that links to the file I was miming, instead of the application that actually contains the file: the “/” application that serves the purpose of document root. Once I redeployed “/”, it all worked fine.