IDEA 7: problems creating web service

Hello.

I've got some problems creating web service in Idea 7 and deploying it on JBoss 4.2.2. I've spent much time but haven't found any issues or some tutorials how to use this new feature. Also tried to create web service myself: i've got and deployed war file with web service (don't know if i created it properly), but web service was not found on JBoss. Don't know how to understand it.
Does anybody have an experience of creating web service and deploying it, using Idea 7 ? Or have some ideas to help me.

Thank you.

14 comments
Comment actions Permalink

Basically, we have two options developing web service for full javaee container:
1. Web tier code is exposed as web service. WebServices plugin aids in this case.
1. Session EJB is exposed as webservice. E.g. for JavaEE 1.4 In this case one needs add necessary artifacts, set 'service-endpoint' in ejb-jar.xml and tweak jboss.xml as necessary.
Could you please elaborate on what type of webservice you want to produce and desired web services engine to use?

0
Comment actions Permalink

Thank you for reply.

I want to have web tier code as web service. And i tried to use built-in Web service plugin.
I know Java not well yet and don't understand what web services engine is.

0
Comment actions Permalink

I'll try to explain the problem more concrete.
I use IDEA 7.0.2 and JBoss 4.2.2

I make following steps with IDEA:
1. Create empty project.
2. Add new module. On the last screen ("Please select the desired technologies") check "Web application" and "Web services" under it.
3. Configure run: add jboss local configuration. Also in Java EE Build Settings i check "Create web module war file".
4. Run the project
During deploying i get following errors:
...
Facet Web: Module is being deployed, please wait...
08:20:11,781 INFO deploy, ctxPath=/Web, warUrl=.../tmp/deploy/tmp34095Web-exp.war/
08:20:11,812 ERROR Feb 12, 2008 8:20:11 AM com.sun.xml.rpc.server.http.JAXRPCServletDelegate destroy
INFO: JAXRPCSERVLET15: JAX-RPC servlet destroyed
08:20:11,828 ERROR Feb 12, 2008 8:20:11 AM com.sun.xml.rpc.server.http.JAXRPCContextListener contextDestroyed
INFO: JAXRPCSERVLET13: JAX-RPC context listener destroyed
08:20:12,687 ERROR Feb 12, 2008 8:20:12 AM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
INFO: WSSERVLET12: JAX-WS context listener initializing
08:20:18,390 ERROR Feb 12, 2008 8:20:18 AM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
SEVERE: WSSERVLET11: failed to parse runtime descriptor: com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.api.wsdl.writer.WSDLGeneratorExtension: Provider com.sun.xml.ws.policy.jaxws.PolicyWSDLGeneratorExtension could not be instantiated: java.lang.ClassCastException
com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.api.wsdl.writer.WSDLGeneratorExtension: Provider com.sun.xml.ws.policy.jaxws.PolicyWSDLGeneratorExtension could not be instantiated: java.lang.ClassCastException
at com.sun.xml.ws.util.ServiceFinder.fail(ServiceFinder.java:219)
at com.sun.xml.ws.util.ServiceFinder.access$300(ServiceFinder.java:127)
at com.sun.xml.ws.util.ServiceFinder$LazyIterator.next(ServiceFinder.java:363)
at com.sun.xml.ws.util.ServiceFinder.toArray(ServiceFinder.java:211)
at com.sun.xml.ws.server.EndpointFactory.generateWSDL(EndpointFactory.java:405)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:178)
...
(more then 100 lines in all)

0
Comment actions Permalink

It seems to me that JBoss or its JDK (6) have some classes that are deployed in your application so I would update IDEA web module settings in order to remove the duplication

0
Comment actions Permalink

I reinstalled JBoss and made same steps to create web service. No exceptions occurred but it seems that there is no web service in web module.

Page http://localhost:8080/Web/ (Web - name of web module) contains index.jsp.
I open http://localhost:8080/Web/services and "The webpage cannot be found" appears. But there must be a list of deployed webservices (even empty if no web services was deployed.

This is my web.xml:

com.sun.xml.ws.transport.http.servlet.WSServletContextListener JAX-WS endpoint WSServlet WSServlet com.sun.xml.ws.transport.http.servlet.WSServlet 1 WSServlet /services/* ]]>

Do you know why web service cannot be found ?

And what do you mean saying "JBoss or its JDK (6)" ? I use jdk1.5.0_09 and does JBoss have it's own jdk ?

0
Comment actions Permalink

JDK 6 includes jaxws implementation and thus requires 'endorsed.dirs' setting to use another version of jaxws (and without this setting weird errors appear).
AFAIK jaxws (unlike e.g. Axis) does not have 'services' page, instead, when the server is running you can invoke 'Show Deployed Web Services' action (Tools | WebServices) which will create page of exposed web services on page. Alternatively, you can check http://localhost:8080/Web/services/]]>?wsdl to see if the server is online

0
Comment actions Permalink

Thank you very much !!!
It works

I'm just starting to learn this technologies and don't know things you mention.
I tried 'Show Deployed Web Services' but only "And now... Some Services" was shown, without any services. But http://localhost:8080/Web/services/ shows a table with web service information and http://localhost:8080/Web/services/]]>?wsdl shows wsdl.
Also i created client for this web service and called web method. This works.

Thank you for your great help.

0
Comment actions Permalink

Great. Could you please confirm that you have invoked 'Show Deployed Web Services' with Web parameter and it showed no services?

0
Comment actions Permalink

Sorry, I've set the name of web service instead of the name of facet ("Web") in the 'Show Deployed Web Services' dialog. I'd tried with correct name and page with information about my web service appeared.
And sorry for my english.

0
Comment actions Permalink

I've got another problem. When I just add new webmethod, i get such error:

com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized
SEVERE: WSSERVLET11: failed to parse runtime descriptor: runtime modeler error: Wrapper class example.jaxws.Test is not found. Have you run APT to generate them?
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class example.jaxws.Test is not found. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:254)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:550)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:497)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:339)
...

I only want to add my web methods to generated webservice. How can i run APT in IDEA and is it really needed ? Can anybody help me with this error ?

0
Comment actions Permalink

You'd need to run 'expose class as webservice' again since your class got additional web method and it requires marshalling/unmarshalling code too.

0
Comment actions Permalink

Thanks. This helps, but i've got same error when created javaEEApplication module and included web module with webservice in javaEEApplication module. I've also run 'expose class as webservice', but this doesn't help.

0
Comment actions Permalink

Or, another time, deploy is successful, but there is no web service at http://localhost:8080/Web/services/MyWS - just 'webpage cannot be found'.

How can i create web service in web module, which is included in another module ? Seems there must be done some additional settings.

0
Comment actions Permalink

JEE Application module has its own setting of web context in corresponding descriptor file

0

Please sign in to leave a comment.