45 Replies Last post: Feb 10, 2007 9:32 PM by Arun Gupta  
Arun Gupta Newbie 30 posts since
Jun 5, 2004
Currently Being Moderated

Jan 23, 2007 1:12 AM

How to create a Web service ?

With IDEA 6.0, I searched:

 

- bundled help

- online documentation

- forums

- intellij.net

 

but not able to find any documentation on how to create a Web service starting from Java and deploy it on a JavaEE compatible server, for example GlassFish. I could configure GlassFish but what other steps are required to develop/deploy/invoke the Web service ?

 

Thanks,

-Arun

Norris Shelton Apprentice 679 posts since
Aug 29, 2002
Currently Being Moderated
Jan 23, 2007 4:48 PM in response to: Arun Gupta
Re: How to create a Web service ?

Please do not post in multiple forums.  Research Apache Axis.

Stephen Friedrich Expert 1,486 posts since
Aug 21, 2002
Currently Being Moderated
Jan 23, 2007 5:00 PM in response to: Norris Shelton
Re: How to create a Web service ?

I think the question is reasonable - other IDEs do have special support for WebServices.

 

I'm afraid Idea doesn't (but I am not really sure - even though I consider myself an experienced Idea user, I still discover new features every now and then).

Mike Key Newbie 6 posts since
Oct 1, 2006
Currently Being Moderated
Jan 23, 2007 8:48 PM in response to: Arun Gupta
Re: How to create a Web service ?

There is a plugin for web services support, I believe its just called WebServicesPlugin.

 

However I would agree that in the modern age the fact that IntelliJ does not have core web services support is really strange and annoying.  It is one of the few things I dislike about IDEA. 

 

And on the topic of WebServicesPlugin, it seems to be very slow to rev. and has cross platform issues I've experienced (won't work on a *NIX based platforms).  I submitted a bug to them and they said it would be fixed in the next revision coming soon...which was a few months ago with no update since.

 

Hate to turn this into a rant but I think its about time to speak up and ask for solid WS support in IDEA.

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 23, 2007 9:36 PM in response to: Arun Gupta
Re: How to create a Web service ?

Java Web Services Development Pack v 2 (= JWSDP2) contains JAX-WS 2 ea

Java SE 6 contains JAX-WS 2 final

Plugin supports working both stable versions and work with JEE 5 (Glassfish based) JAX-WS 2 configuration

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 23, 2007 10:26 PM in response to: Arun Gupta
Re: How to create a Web service ?

There is indeed some learning curve (or from another perspective, ways to enhance the plugin, the plugin is just coming to 0.7

Information on getting started is provided in WebServices tab that appears after plugin installation.

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 24, 2007 2:47 PM in response to: Arun Gupta
Re: How to create a Web service ?

You seem to be using different module type

Create new project with WEB module (all default settings).

Create service class

Invoke 'enable web services support' on the module with 'JWSDP2' setting.

Annotate java class as WebService and compile it.

Invoke 'expose class as web service' on created class.

Run local tomcat with this module deployed .

-


web service is ready for consuming ---

Generate Java Code With Wsdl with appropriate wsdl url

In client code invoke 'Generate' action that generates stub code for web service invokation

Run the client

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 24, 2007 8:55 PM in response to: Arun Gupta
Re: How to create a Web service ?

will update the description for 0.7.1

try http://localhost:8080/services/hello

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 24, 2007 9:24 PM in response to: Arun Gupta
Re: How to create a Web service ?

Simplest way to run web service with TomCat (I use 5.5.17 / JDK 1.5) in development mode is leave default 'exploded' deployment (need selecting the module in Deployment tab of Run configuration) and do copy all the jars (also set by default). When using GlassFish/JDK 1.6 or JEE5 for servlet container or production server the JWSDP jars should be removed from deployment (module settings -> Web ModuleSettings)

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 25, 2007 12:17 AM in response to: Arun Gupta
Re: How to create a Web service ?

Expose class as WebService action launches generation of deployment code (you should see sun-jaxws.xml and \*.java) and externally generated code seems not picked/compiled by Idea before running TomCat, please, invoke 'synchronize' (control + alt + y usually) after 'expose' action completes.

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 28, 2007 12:34 AM in response to: Arun Gupta
Re: How to create a Web service ?

Expose action does generation of web services stubs, if one does not do "synchronize" then on IDEA's subsequent compile / make the generated sources/classes does not get copied into exploded directory (and thus does not found during web context initialization). I suggest you to create JIRA item with your zipped sample project attached and I will look for it ASAP (It works with my clean project created from scratch).

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 28, 2007 12:47 PM in response to: Arun Gupta
Re: How to create a Web service ?

This seems to be bug of JWSDP with classes in default package.

Put the web service class into some nonempty package and all starts to works.

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 28, 2007 12:50 PM in response to: AdvancedTools
Re: How to create a Web service ?

Beware of possible http://www.jetbrains.net/jira/browse/WSVC-41 issue during expose, the issue description contains workaround

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 31, 2007 6:53 PM in response to: Arun Gupta
Re: How to create a Web service ?

Remove j2ee.jar from classpath of the client module (or move it down in priority) in Dependencies tab of the client module settings.

Btw, you can quickly generate web service invokation by using Generate action (Alt + Ins on Windows)

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 1, 2007 3:48 PM in response to: Arun Gupta
Re: How to create a Web service ?

Nice, I wonder however if web service "autodetection" works in the older versions of the Glassfish (e.g. JEE 5), since if it isn't, then one still needs some additional magic passes

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 24, 2007 2:48 PM in response to: Arun Gupta
Re: How to create a Web service ?

And thank you for the feedback

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Jan 24, 2007 9:00 PM in response to: Arun Gupta
Re: How to create a Web service ?

Surely, the plugin will be updated for smoother initial experience (probably, wizards :).

For interested users: problems with WebServices plugin are tracked in JIRA http://www.jetbrains.net/jira/browse/WSVC

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 1, 2007 3:20 PM in response to: Arun Gupta
Re: How to create a Web service ?

Basically when one wants to use GlassFish based web service then it is enough to point to GlassFish install in WebServices plugin settings. After that, just repeat the steps for web service develop/deployment you have done previously.

As to JDK6: when JWSDP2 path is empty and the client module uses JDK6 then generation of web services client stubs will proceed with JDK6 built-in tools.

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 1, 2007 7:29 PM in response to: Arun Gupta
Re: How to create a Web service ?

Just point JWSDP2 path to Glassfish install

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 1, 2007 7:52 PM in response to: Arun Gupta
Re: How to create a Web service ?

Weird, plugin accepts Glassfish directory if it contains subdirectory 'lib' that contains 'appserv-ws.jar' containing JAX-WS implementation. This works for JEE 5 install.

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 1, 2007 8:04 PM in response to: Arun Gupta
Re: How to create a Web service ?

Ok, will include the support for Glassfish v.2

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 5, 2007 6:01 PM in response to: Arun Gupta
Re: How to create a Web service ?

You can use GlassFish v.2 or JAX-WS 2.1 RI with updated version of the plugin

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 5, 2007 10:40 PM in response to: Arun Gupta
Re: How to create a Web service ?

Please, add Glassfish specific descriptor in Web Module Settings.

Add unique -context-web-root- value like /myhello

AdvancedTools  Novice 133 posts since
Jan 14, 2006
Currently Being Moderated
Feb 5, 2007 11:35 PM in response to: Arun Gupta
Re: How to create a Web service ?

In sun-web.xml you need to add 'context-root' tag with appropriate value. Result

sun-web.xml looks like following text:

-


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sun-web-app PUBLIC

        "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN"

        "http://www.sun.com/software/dtd/appserver/sun-web-app_2_5-0.dtd">

<sun-web-app>

  <context-root>/myservice2</context-root>

</sun-web-app>

-


JAX-WS RI needs sun-jaxws.xml to have description mapping from context path to web service class.

If you deploy web app interactively via application deployer then all such application vendor specific files are hidden under the cover.

More Like This

  • Retrieving data ...