Applet Web service client, with Eclipse Indigo using Apache CXF, - applet

I'm trying to consume a web service within an applet.
For that objective i've tried Apache and Apache2, both with good results
but the problem is that the jar dependencies are far too fat for my application
(the jar for axis or axis2 are over 1.5MB, and the applet is less than 200KB)
So i will try consuming the web service with Apache CXF, hoping that the jars
are at least a bit smaller.
Using eclipse one creates an empty project and in the main classes implements
the applet and blah blah, but to create the web service one must use the web service
wizard.
I've used this wizard before, to consume the web service using Axis, but the moment i choose other options i get this message:
****The Apache CXF 2.x Web service runtime in Tomcat v7.0 Server does not support the client project****
What i´m missing?
I've already installed, CXF 2.x runtime, and the Tomcat 7 Server, and of course the Eclipse Web Tools.
This question How to generate web service client with Apache CXF in Eclipse Helios?
shows a very hard solution and it´s one year old!
is there any other way to consume webservices within an applet?
ksoap2 has no documentation on complex webservices, and ksoap2-android
neither
Sorry for a boring question, but any help is greatly apreciated

Apache CXF 2-x Web service runtime Tomcat Server not support client
The Apache CXF 2.x Web service runtime in Tomcat v7.0 Server does not support the client project
Answer: If you see above error during creating web service client in eclipse using Apache CXF means you are using java project to generate the client from WSDL. Latest version of JAX-WS supports Dynamic Web Module v2.5 and up. So create client using apache CXF first you need to create Dynamic web project.
Once dynamic project created then open web service client wizard to create client from WSDL and issue should be resolved.

Related

Tomcat restful web service database (JPA) with Netbeans does not work

I have been able to create Restful web services with JAX-RS for Tomcat. Using the Netbeans Restful web service from patterns wizard.
But I am not able to create Restfull web servicer from database with Netbeans wizard.
It miss some libraries. I add openJPA and Java EE web api 6 (over the added by the wizard). But it continues not working.
I added javaEE-TomEE 8.0 but did not work, either!
Does anybody know what have I to add to Tomcat to get JPA-Database Restful service working?
Moving to GlassFish is not an answer valid... I want to keep on Tomcat (adding the minimal)
I have made some advances...
With EclipseLink(JPA 2.0) I was able to connect MySQL in a desktop application...
Then I switched to Apache OpenJPA and I was no able to get an EntityManagerFactory...
So it seems I choose a library incomplete...
I imagine, in Tomcat, I have to choose other library than OpenJPA.

Jersey Rest service: 'Resource /Servers is not open'

I am new to Java EE and am trying to learn the same using tutorials and examples online.
I am trying to follow http://www.vogella.com/articles/REST/article.html#first and create a RESTful service using Jersey.
Since this is my first RESTful service, I have basically copy-pasted whatever code is present till http://www.vogella.com/articles/REST/article.html#first_run.
However, when I try to run the service, I am getting an error:
Could not load the Tomcat server configuration at /Servers/Tomcat v7.0 Server at localhost-config. The Servers project is closed.
When I tried looking into the server configuration, I see that the configuration path is showing an error for the value: /Servers/Tomcat v7.0 Server at localhost-config.
When I try to change any (server) configuration and save it, I get the message: "Error while saving. Resource '/Servers' is not open."
Five differences between my project and what is described in the page:
I am using JDK 1.7, while the page mentions JDK1.6.
I am using Apache Tomcat Server 7.0, while the page mentions Tomcat version 6.0.
The Dynamic web module version is set to 3.0 in my project, while it is 2.5 in the page.
I have a couple of practise spring apps configured on my tomcat server. I am not sure how to remove them. :(
I have updated my web.xml to use web-app_3_1.xsd in the place of web-app_2_5.xsd.
I am not able to understand why this is happening.
If this does not seem to be solvable, I would be thankful, if you can point me to any resource that explains creating a RESTFul service using Jersey using Java EE7, Apache Tomcat 7 and, preferably, Eclipse.
The solution turned out to be simple. When I looked at the Project Explorer, I saw that there was a project called "Servers". Once I "opened" this project, the problem got resolved.
Seems like marking all projects and selecting "Close Project" has a side effect in Java EE Perspective. :)

GWT Deployment to JBoss

I am currently working on a project which has a GWT frontend and a seperate Java module with servlets and a REST interface on the backend. The project when deployed runs on a single JBoss server.
I am running into difficulties though as when I run the GWT app in hosted mode (in eclipse) the jetty server does not have a deployed Java module to interact with.
My idea was to setup a JBoss server which eclipse could deploy into for development purposes, the problem with this is that the installer for the product sets up a JBoss server with a GWT app already embedded in it, so redeploying into this JBoss instance might cause problems?
My other idea would be to create a second JBoss server to host the GWT app, with some sort of url redirect for the rest calls which would redirect to the first JBoss instance. Is this possible?
EDIT: Can I do this with the built in jetty server in eclipse and not have to worry about using a seperate JBoss server. In other words can I somehow get the jetty server in eclipse to redirect particular requests to a different URL?

Eclipse doesn't import all Axis2 jars but project still runs on Tomcat?

When I develop an Axis2 web service on Eclipse, I noticed that Eclipse is automatically copying the classes from the lib folder of Axis2 to the lib folder of the new project. However, not all classes from the lib folder of Axis2 are being copied. Interestingly, the web service runs without any problem when deployed to Tomcat via Eclipse even if some the jars from Axis2 were not copied. Also, when I viewed the temp file of Tomcat, Tomcat seems to generate the jars for the listed modules on modules.list of the web service.
Can someone enlighten me regarding what is happening on this? Why Eclipse doesn't copy all the jars from Axis2? Why can the web service run on Tomcat even without the other jars from Axis2? What are those temp files for? When and why is it being generated?
I tried to run the same project on WebSphere and I am encountering a ClassDefNotFound exception because of the missing jars. My problem was solved when I copied all the Axis2 jars that was not copied by Eclipse to my project. But I'm not comfortable with my solution because Tomcat can run my project even without those jars. Is my solution really the right solution? Or am I missing a configuration setting?
This is just for clarification:
My web service is already running in Axis2. My class loading policy is set to PARENT_LAST. I know that since WebSphere has its own Axis2 configuration, the class loading policy must be set to PARENT_LAST so that WebSphere will use the Axis2 from the project itself. Aside from setting the class loading policy, I did something to make my web service run on WebSphere. I describe what I did above. My question is why such method must be taken?
WebSphere has it's own axis2 configuration as part of its Java EE server spec for JAX-WS. Change your class loading policy to PARENT_LAST and check if that solves your problem.
Edit:
As the original post already states: WebSphere is a Java EE server depending on version it supports its the standard Java JAX-WS web services. Actually web services became part of the standard jdk.
If you use JAX-WS like mentioned in Introduction to JAX-WS or building web services then you don't have to add any 3rd party library for getting your web services running. As soon as you use the non JDK implementation like axis2 you have to package it with your application.
IBM didn't just pack the axis2 into their WAS/JDK, they modified it. I'm not sure what Tomcat delivers, however as long as you use JAX-WS it shouldn't matter. With JAX-WS you don't have any direct import of the org.apache.axis packages. If you use these imports you have to supply the libraries and make sure that yours are loaded.

IBM Websphere Integration Developer - Using JAX-RS

I know this isn't the best place to put this question but here it goes...
I'm using IBM Websphere Integration Developer...
I used JAX-WS runtime to create webservices from a Java test class, that instantiates severall other classes.
I did this by:
Right clicking on the Java test
class
Web Services -> Create Web Service
Service: Webshpere Process Manager v7.0 Web Service Runtime: IBM
Websphere JAX-WS
Checking "Publish the Web Service" -> Next -> Document Wrapped
Checking "Generate WSDL file into the project"
Checking "Configure WSDL service name" -> Finish
This resulted on the creating of a Delegate Java class on the same package of the test class
The creation of a WSDL file and an XSD file.
The Web Service is working great an this is solved...
No I need to have a similar process to generate a REST web service, and found out the JAX-RS API.
In order to have this I installed the "Websphere Application Server Feature Pack for Web 2.0" and thought that by doing this I would have the abilitty to use no only JAX-WS, JAX-RPC, but also JAX-RS, but this doesn't work.
I need the ability to generate REST Web Services automatically from a Java text class so is or isnt this possible?
Regards
As it turns out the automatization supplied by the usage of JAX-WS and JAX-RPC is not possible at this moment for JAX-RS API.
Despite of this, you can do this quite easily using Rational Application Developer, but not as easily on Websphere Integration Develloper.
Regards