Glassfish does not show my webservices - web-services

I have a very simple webservice as follow:
package testSmart;
import javax.jws.*;
#WebService
public class Add {
#WebMethod
public int addElem(int i, int j){
return i+j;
}
}
Now when I use the following link:
http://localhost:4848/common/index.jsf
But when I open it the Add webservice is not shown in the table:
Just for more explanation I am following the following video which does he same:
youtube
Can anyone tell me what is the problem?

Download the Full Profile version of Glassfish and not the web version. Here is the link to download.

it seems your classes are not compiling under default build/classes directory.
Do either of the following: Right click on your project > Build Project. or Go to eclipse menu > Project > Build Automatically
Now redeploy your application again. webservices Engine should be visible along with web engine.
go through below link it might help you,
https://docs.oracle.com/cd/E19798-01/821-1752/gbixz/index.html
if you have 'Web Profile' version of GlassFish then Download the 'Full Profile' version of glassfish.

Related

Can't run my Spring MVC project on a Tomcat web server (local)

I have used Spring Template Project to create a Spring MVC Project. It works fine running it on the "VMware vFabric tc Server Developer Edition v2.8"-server. But when I move it to the Tomcat server and I try to run it it doesn't work. When I try to access the site I get following:
HTTP Status 404 - /analyse
type Status report
message /analyse
description The requested resource is not available.
Do I have to convert the project some how? It doesn't have the same structure as the other projects in the webapps-folder.
Any idea?
So basically I need to know what has to be done in order to run my Spring MVC Project on my Tomcat-server.
Aprreciate any help I can get!
What is the name of your *.war file?
Typically you can access your app via a URL by the same name, minus ".war"
The problem is in deployment assembly,you have to check it.
As you are using maven so you can type following command
eclipse:eclipse -Dwtpversion=2.0
so it will solve deployment assembly problem and also download necessary jar's.
Then run command
clean install
and clean the project from
project clean option.
Go to Project --> Properties configure Java, Javascript and Dynamic Web Module.
And now you can access the application in Tomcat Server as well. The problem is in deployment assembly.
Properties Configuration

REST services running on Glassfish

I've developed REST web services using Jersey with NetBeans IDE.
Now I want to provide those services on Glassfish 3.1, without using NetBeans.
I want something like the .aar file that is created when we build web services with Apache Axis2.
Can you tell me how to do it? I have to use the .WAR file, right?
It is something like: http://qallme.sourceforge.net/docs/sec_DeployingAWebService.html ?
Thanks
I could do it by following that tutorial that I've mentioned above.
At first that was not working because of the context-rooton glassfish-web.xml. I had not filled it with the root resource.

Glassfish 3.1: Cannot find 'View Endpoint' link after deploying a WebService

I wrote a web service and deployed it on Glassfish 3.1 but I am not able to see the link 'View Endpoint' link under 'Action' column. I am using the 'Glassfish 3. 1 Administration Tool' at 'http://localhost:4848/' under 'Application' under 'myapp'. After getting the web services deployed, I do see the 'webservices' added under the column 'Engines'. I need that link for finding 'Web Service Endpoint Information' so that I could see the WSDL and test the web service using Tester feature given by Glassfish 3.1.
Could someone help me understand whay am i not able to see that 'View Endpoint' link under the 'Action' column in the 'General' section.
Thanks.
That's how it worked for me:
Check if web.xml exist in your project (possible it is in webapp/WEB-INF/web.xml).
Delete web.xml.
Restart GlassFish server and "View Endpoint" link will appear.
I had the exact same issue - when I stopped and restarted the Glassfish server, the "View Endpoint" link appeared. Not sure if that will work for you, but it did the trick for me.

Where to place clientaccesspolicy.xml in Netbeans Webservice project?

I develop a Webservice using Netbeans 6.9 and I use an embedded glassfish server to deploy my Webservice (http://some_domain/project_name/ws_for_sl4). On a different server there is deployed a Silverlight 4 client, which should have accesss to the Webservice.
I know that I have to have clientaccesspolicy.xml (under http://some_domain/project_name) however I do not know how to do it. I mean, I do not know in which folder of the netbeans project I need to put clientaccesspolicy.xml to have it automaticly deployed on an embedded glassfish server. To have my SL4 client using the webservice.
Solution:
- put clientaccesspolity.xml and crossdomain.xml under /Web Pages*
- open Project Properties (click right mouse button on a project root), go to Run, and delete a value of "Context Path".
Now your WS will be deployed directly under some_domain as it is required by SL4 (SL4 is looking for these files under the domain name.). SL4 will have no problem to access clientaccesspolity.xml and crossdomain.xml.
In case anyone doesn't like moving their webservice to "root", and instead prefers to have it in http://localhost:8080/aDifferentLocation/MyActualWebService, then placing those XMLs in the project Web Pages folder doesn't cut it.
http://localhost:8080/aDifferentLocation/clientaccesspolicy.xml
and
http://localhost:8080/aDifferentLocation/crossdomain.xml
would not work, as they need to be in
http://localhost:8080/clientaccesspolicy.xml
and
http://localhost:8080/crossdomain.xml
To achieve this, you must track down the folder where your GlassFish server is installed, let's call it [GlassFishInstallPATH] and paste the XMLs into the subfolder called docroot:
[GlassFishInstallPATH]/domains/domain1/docroot/ <--here go the XMLs.
(source)
In case you're wondering how you would do the same thing in Eclipse, you must track down the ROOT folder in your Eclipse J2EE workspace:
C:\Eclipse_j2ee_workspaces\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT/ <-- the XMLs go here.

Consuming a web service with the Netbeans Platform

I have an application that is written with the NetBeans Platform 5.5. I'm having trouble consuming a web service.
If I create a Java SE application in NetBeans, I can add a web service reference without problem.
Since my application is using the NetBeans Platform, many of the menu choices change. So, I cannot figure out how to add a reference to the web service. I've googled this topic a number of ways but haven't found any pages that deal with consuming a service through the platform. They all talk about consuming a service with a Java SE application.
Changing the application from the Platform architecture is not an option.
Here is a good tutorial for setting up a Feed Reader on NetBeans Platform. It covers some of the configuration issues for using web services
Blog with an entry about making a web services client
I'd be happy to try and give you a more specific answer if you can give information about the service you want to access.
Found this:
Create web service and client using this tutorial
Create library wrapper module for web service client (you don't need to include JAX-WS libs, only your client jar)
In your wrapper module add following dependencies (important):
JAX-WS 2.1 API
JAX-WS 2.1 and JAXB 2.1 Library (for this you have to check Show Non-API Modules in "Add Module Dependency" window)
If you try to build module after these steps it will fail telling you that your module is not friend of "path-to-netbeans"/java2/modules/org-netbeans-modules-websvc-jaxws21.jar.
Right click on JAX-WS 2.1 and JAXB 2.1 Library and choose Edit. Select Implementation Version.
from here.