Where to place clientaccesspolicy.xml in Netbeans Webservice project? - web-services

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.

Related

Codename One: Webservice not available

I used the CN1 Webservice Wizard to add a the webservice proxy to my mobile app and to generate all the server side code. I have a local XAMPP installation with a tomcat linked within my Eclipse IDE. Also, I imported the server generated code as a new Java Project and added the "Dynamic Web Module" project facet to it so that I could launch it not as a local Java application but rather on the Tomcat server.
When starting my client, I noted that I get HTTP 404, resource not found errors. I traced the error back to the URL, where the server is hosted to.
I know I have to adapt the urlPatterns parameter in the generated class CN1WebServiceServlet, which I did. Also, I checked the context of my app in the Web project settings and defined the value for context root. So, in my client app, the URL to call the service should be
http://localhost:8080/< context root>/< urlPattern>
However, even when calling that in the browser, I should get the result of the doGet method of the server generated code, showing the message "Webservice access only". Instead, I get 404 errors all the time.
Is there some problem to importing the server generated code as a plain Java project and adding the web parts to it afterwards? How would that be done in the ideal case?
And what other problems might be hindering the URL from properly being published on the server side?
Thanks and best regards
EDIT
I stripped everything from the project to limit the options and I found the cause: when using the web service wizard to dump the source files into a new directory, adding that with the Eclipse import wizard, it will be looked at as a plain java project without any web components. Using the project settings to add the dynamic web piece to it (Eclipse calls those project facets), the CN1 webservice will NOT work.
If instead you create a "Dynamic Web Project" first and then use the CN1 Webservice Wizard to dump the server source files into the "src" folder of that project, it works without any issues.

How to "Run" a .svc WCF Web Service

I am working on a project that was last worked on by someone who hasn't been on the team in some time. Having gotten a hold of him to ask him questions about the project and next steps in general, I was told I need to run a Java web service. After not being able to find any .jws files in our network, I asked if a particular .svc (WCF Web Service) file was the right service and was told to "run [filename]" which is the .svc file. This file is in a directory with some relevant Java class files that appear to have been part of an eclipse project (which I am unable to open).
Now I've looked around and all tutorials I can find about running a .svc file involve a visual studio project and creating the project from scratch, not just running a single .svc file as a web service. I'm new to Windows in general and haven't seen a .svc file. Does it make since to say to simply "run" a .svc WCF Web Service? And does it make since that a .svc file would be created from a Java project? If so, how would I simply run that service?
I hope this question made sense. Thanks for any help!

ELMAH does not work after moving to a new server

I made a complete copy of the old web application.
Copied it to the new server.
Made appropriate SQL Server changes and it does not work.
ELMAH Version: v1.0.3705
OS: Windows Server 2012
IIS 8
I believe I found your answer. You need to grant your IIS AppPool permission to modify (or write) to the path you have instructed ELMAH to write the XML. To do this, bring up Windows File Explorer, locate the path and folder where ELMAH is writing those XML, right click to get folder menu and select properties, locate and click on the tab labeled SECURITY, and follow the instructions described in this URL:
http://www.iis.net/learn/manage/configuring-security/application-pool-identities

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

Create a virtual directory in wso2

I am using wso2 application server v4.0 on Linux.
I have a webapp and I want to have a folder to store files. The folder size can be huge and the application could be redeployed as well, so directory is not inside the webapp.
How do I create a virtual directory or similar in wso2? That directory can be general, i mean it is not needed to be related to the webapp examples: localhost:80/myDirectory/ and localhost:80/myApplication/myDirectory/ are valid approaches to me.
There are some clear instructions to do it in tomcat but I can't find out how to translate this to tomcat in wso2.
Please checkout the sample available here.