aspose file tools*
The moose likes Web Services and the fly likes Use Eclipse to create simple web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Use Eclipse to create simple web service" Watch "Use Eclipse to create simple web service" New topic
Author

Use Eclipse to create simple web service

Bobby Anderson
Ranch Hand

Joined: Oct 28, 2008
Posts: 114
I am try to use eclipse to create a simple web service but I have been hitting my head against the wall for over three weeks. I am using Eclipse 3.4 and JBOSS 4.2.x as my app server. So there are a ton of tutorials out there but NONE OF THEM use eclipse 3.4 oand JBOSS 4.2. They were all written over a year ago and are very outdated. When I try and follow them I run into all kinds of issues becuase certain steps the tutorial points out no longer even exist in Eclipse 3.4.

Has anyone found a tutorial on how to use Eclipse 3.4 to create and test a web service. If not someone a lot more advanced than my self should spend 30 minutes and write one it would be a tremendous help. I have searched all over the web and there are tons of people looking for something like this but everything is out of date.

Please help!!!

Thanks,
Billy
Bobby Anderson
Ranch Hand

Joined: Oct 28, 2008
Posts: 114
So far I have been able to:

1. create a 'dynamic web project in eclipse' named 'WSTutorial'
2. create a new java class called 'Hello.java'
3. inside Hello.java write a simple web service as follows
@WebService
public class Hello {
@WebMethod
public String sayHello(String name) {
return "Hello " + name;
}
}
4. Now I want to use eclipse to publish the web service to jboss and create a WSDL file. So I select New -> Other -> Web Service. Now here is where I get lost I can either use jbossWS or axis as my 'web service runtime' option.
4a. If I choose jbossWS and hit next I get an error saying "Could not load class, did you specify a valid classpath."
4b. If I choose axis and hit next I get a little further but I end up getting a a configuration error.


Again I am still looking for a good UP TO DATE tutorial using eclipse and JBOSS if anyone has seen one or has done this in the past please help.

Billy
Bobby Anderson
Ranch Hand

Joined: Oct 28, 2008
Posts: 114
Ok so I guess the real question is how do I generate a WSDL file using jbossws (not axis) in the eclipse IDE. Seems everything I try I still get the followgin error:

Error: Could not load class [and]. Did you specify a valid --classpath?

This pop-up happens when I try and create the web service using Eclipse's 'bottom up java bean web service' wizard.

Do I have something configured wrong with jboss in the eclipse IDE.

anyone?
Elias Ta
Greenhorn

Joined: Sep 29, 2008
Posts: 15
Billy,
I am sorry to say this but the so called experts in this forum are either not willing to help or have very little real life experience in web services. They just want to look smart by asking back more questions than actually helping.
Compare to other forums like oracle, these guys are so just useless except looking down on people with questions.

I asked 6 questions and never got a single good answer, just a waste of time.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18159
    
    8

Elias, I had a look at all of your posts. What you say there doesn't agree with what I see, and I believe what you said is insulting to the people who tried to help you with your problem. Please remember that the main rule of this forum is "Be Nice". Insulting people who might help you isn't nice and it isn't a good strategy for getting help either.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

Billy, you might get more answers asking this in the IDE forum because this is not a web services issue, but rather a "how do I get Eclipse to do this" question.

Personally, I do not rely on Eclipse for more than being a glorified text editor. I could tell you how to get your web service built and running on JBoss AS, but I could not tell you how to get Eclipse to do that. (I find that there is nothing more frustrating when learning a new technology than trying to get Eclipse to work correctly. I find using Ant much more intuitive for build and deploy tasks - at least I know what it is doing and there is very little magic.)

Do you by any chance have the JBoss Tools plugin installed into Eclipse?


JBoss In Action
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

I just had a thought. Forget the New -> Other -> Web Service stuff. Instead, simply deploy the web application to the server as if were any old web app. That should be all you need. Then point your browser to http://localhost:8080/jbossws.
Bobby Anderson
Ranch Hand

Joined: Oct 28, 2008
Posts: 114
Thanks for the help Peter. Unfortunatly I tried that already. When I go to ../jbossws it says I don't have any webservices deployed. I also would like Eclipse to generate a WSDL file for me but it won't do that unless I use the 'bottom up web service' creation wizard.

I am very, very new to java EE so I am trying to do some simple things first and using an IDE that generates things for me is a nice start. I also do not know how to use ant yet. That was my next hurdle after getting a few things deployed and working.

If you or anyone else has any ideas let me know.

Thanks again!
Billy
Bobby Anderson
Ranch Hand

Joined: Oct 28, 2008
Posts: 114
Oh yeah forgot to mention that Yes I do have the JBOSS tools plugin on Eclipse. Not sure if that makes a difference or not. But I thought that I needed it.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

Sorry, but I have not even attempted to create a web service using the "Eclipse way", so to speak. You can find a complete web service example here. But I have no idea for how to get Eclipse to do the work for you (I did edit both the pojo and the web.xml using Eclipse, but used ant to build the web.xml and copy it to the deploy directory.)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

I would also suggest looking at chapter 9 of JBoss in Action - it contains several complete web service examples, both EJB and POJO-based. But nothing about how to do them in Eclipse.
Lars Vogel
Ranch Hand

Joined: Oct 10, 2007
Posts: 55
Hi,

I'm not sure if this helps but a Eclipse 3.4 tutorial for creating webservices (with Axis2) can be found here: Webservices with Axis2 and the Eclipse Web Tool Platform (WTP) - Tutorial

It uses Tomcat but I assume your problem is creating the webservice not the deployment. From the discussion it seems that JBoss has its own WS stack but perhaps the tutorial can be still of help. Best regards, Lars


Tutorials about Java, Eclipse and Webprogramming http://www.vogella.de
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5779
    
    7

JBossAS 4.2.x does not use Axis so an Axis-based tutorial would not help.
Sonia Batra
Greenhorn

Joined: Nov 08, 2005
Posts: 1
Hi,

I'm new to this group and i'm facing the similar issue. I'm using Eclipse(3.4) with Axis2 to create webservice from java file for me but i'm not able to publish that on Jboss(5.0)server. I woudl really appreciate if someone could help me out here.

Thanks
Benjamin Hiner
Greenhorn

Joined: Feb 27, 2009
Posts: 12
Billy Newman

I have done a web service on JBoss (JBossWS) but it was an addition to an already existing project. As for the things to check for troubleshooting purposes you can:

1. Make sure your jbossws install went ok by running the pre-packaged tests.
2. Make sure your classes compile (look in the bin directory for Hello.class)
3. Confirm that your ear / war are being packaged and reside in the JBOSS_HOME/server/<instance>/deploy directory.
4. Confirm that your web.xml has servlet mappings for the class. (I think this step can be replaced with annotations but I went the web.xml route)

If you are not compiling, you may need to add jars from the JBOSS_HOME/client directory (jboss-jaxws.jar, jaxb-api.jar, etc). There were about 6 that I needed to add but I wasn't using wizards or a "Dynamic Web Project".

Good Luck
shweta jha
Greenhorn

Joined: May 12, 2009
Posts: 3
sometime its giving problem


dialog marketing
san marcos tx apartments
Lalit Bhatt
Ranch Hand

Joined: Dec 27, 2007
Posts: 69
Check http://www.oyejava.com/ Look into the webservices section. If you are new to webservice would recommend to go for JAX-WS. The tutorial for the same are in Webservices section at the above URL.


Java-JavaEE Hibernate Spring Spring Roo Web Applications
Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

What issues are you facing? It is very easy to use the JAX-WS tutorial to create web services in Eclipse. It shouldn't be server specific


===Vyas Sanzgiri===
My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use Eclipse to create simple web service
 
Similar Threads
webservice using Eclipse Europa, for JBoss 4.0.5 GA using Java5, JAX-WS, WS-Security
Cannot deploy simple WS in eclipse
Cannot create bottom up web service in Eclipse using JBossWS
Create simple WS in eclipse using JBOSS
JBoss Time Out Error in Eclipse