Codename One: Webservice not available - web-services

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.

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

execute delphi web service from browser

I've been working on a set of ISAPI web service DLLs in Delphi 2005 that interact with our server application but I'm having real difficulty debugging issues in the web services.
At this time, I have a test SOAP server application as a Web App Debugger executable which uses the same units as the real DLLs.
I can compile and run my SOAP EXE, run the Web App Debugger tool, start the ServerInfo server, and see my SOAP app in the list of Registered Servers.
If I select it from the list and click on Go, it shows the normal Service Info Page, where I can view interfaces and the WSDL.
What I now want to do is Execute one of the methods (a simple one that returns the version info of the ISAPI DLL), and view the request and response by looking at the Log tab of the Web App Debugger, however, I've not found a way to execute the method.
Do I really need to code a special client app to test my web methods? Most examples I've seen online just say to use http://server/service/class/method?parameter=value to execute a web service method, but that doesn't seem to work with a Delphi SOAP web service.
You need to change the client to connect to the machine running the WebAppDebugger. (Typically localhost)
Run the WebAppDebugger and click on the Start button. The 'default URL' lights up... by default is
http://localhost:8081/ServerInfo.ServerInfo
Then run your WAD server project within the IDE and put in your desired breakpoint somewhere in the server code.
If running your client on the same machine, change your client to use the local host address... if you connect today to:
http://www.yourhost.com/yourapp.dll/yourclass/yourmethod
change the client to connect to something like this for debugging the traffic:
http://localhost:8081/wadClassName/yourclass/yourmethod
The name of the Web Application Debugger class is defined when you create the WAD project.

How to get SOAP/WSDL out of Delphi XE WebService in IIS 7.5?

I have the below mentioned problem:
Delphi native Web Service applications not working. IIS 7 seems to be stripping the pathinfo
I did everything outlined in answer 2 (see below or that URL) Didn't help - now I can't run the DLL at all - Firefox wants to download the file, request isn't passed off to ISAPI. I can only launch the WS ISAPI process by permissioning explicitly my webService DLL in the handler mappings for the VD - then the default WS page shows but SOAP and WSDL are never emitted, as explained in above mentioned post.
Delphi native Web Service applications not working. IIS 7 seems to be stripping the pathinfo
"... I can never get to the SOAP. In the same way, the WSDL Importer cannot get to the SOAP either...The problem was that I had created a specific script mapping in the Handling Mappings for the ISAPI dll. This caused IIS to redirect all requests to the specific dll, which was why any request that included an info path part was ignored. The info path was stripped off.
The problem was that I had created a specific script mapping in the Handling Mappings for the ISAPI dll. This caused IIS to redirect all requests to the specific dll, which was why any request that included an info path part was ignored. The info path was stripped off.
What I really needed to do is to simply enable the Execute feature permission of the ISAPI-dll module mapping handler mapping. This module mapping is available for a virtual directory once you have allowed unspecified ISAPI modules (or CGI modules, if that is the kind of Web server extension you have created).
To fix my problem, I needed to
Delete the directory whose handling mappings I has messed up.
Since I already had allowed unspecified ISAPI modules (select Edit Feature Settings from the ISAPI and CGI Restrictions applet from the IIS section of the server), I then needed to add a new virtual directory for the appropriate Web site (here is where I recreated the directory that I deleted in previous step 1.
From the Handling Mappings applet for the virtual directory, you probably have the ISAPI-dll handling mapping disabled. Select it and select the Edit Feature Permissions option on the right-hand side. Enable the Execute checkbox."
I went through .\Windows\System32\inetsrv\config\applicationHost.config and deleted the entries for all of my VDs and DLL's, then uninstalled and reinstalled IIS and made sure to install support for ISAPI extensions and whatever other features it needs.
Then, in the webServer root I set the CGI-ISAPI handlers to allow all unknown ISAPI.dlls, created a new VD and inherited the handlers from parent without permissioning any of my WS module explicitely - now ISAPI process runs and emits WSDL/SOAP.
The problem with this is that you must allow all unknown ISAPI dll's - not particularly secure if you're deploying on a vulnerable public webServer.
MNG

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.

Is there a way to bind my flex builder to my django application

I am trying to create simple flex application, which uses django as a back-end part. Have a question:
Usually when I run my application Flex Builder creates a file in a directory on my local PC and then opens a browser and points to it. Everything was fine, but when I decided to link django server to flex applications via xml data providers I started to get security errors. (Related to absence of crossdomain.xml). When I created the file and put it on the server:
<?xml version="1.0"?>
<!-- http://www.foo.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="http://127.0.0.1:8000"/>
<allow-access-from domain="127.0.0.1"/>
</cross-domain-policy>
Then tried the application again, I got error in console of my FB Error: Request for resource at http://127.0.0.1:8000/go/active/ by requestor from file:///Users/oleg/Documents/FB3/usersList/bin-debug/usersList.swf is denied due to lack of policy file permissions.
I don't know how to fix the error. But also the question is there a way to configure FB3 to put my swf files to the server directly, so I will not need any crossdomain?
Thanks
Oleg
We struggled with this a lot. The Flex security stuff didn't strike me as well built, but perhaps we just had different approaches in mind than Adobe's developers. The solution that worked for us was to serve both the SWF and the dynamic data from the same host and port.
On our development boxes, we tell Apache to serve the SWF from a directory in the workspace, and the dynamic data from a local copy of the app. When we push to production, SWF and app get pushed simultaneously to the same virtual host.
If that's inconvenient for you, the Apache ProxyPass directive can be used to make Apache front for other servers. I've not used that in production, but it's been very handy for developer setups.
I don't know a way to get FlexBuilder to automatically deploy your changed SWF; you could certainly look into an automation approach (like Maven and Flex-Mojos) to make that happen.
That said, getting rid of that error is usually just a matter of adding a policy file to the server.
The second error is caused because you're trying to fetch http resources from a "file" location. My recommendation is that you change your Flex Builder project so it outputs to a location within the Django web site, rather than to the flex-bin directory. This setting can be changed in the properties dialog of the project. Then, you should be able to have your front-end and back-end share the same protocol and domain.