-
1. Re: Why is servlet mapping needed to deploy a web service?
nickarls Oct 3, 2011 2:20 AM (in response to nbhatia)I usually just stick a @Stateless annotation on it now that EE 6 allows for easy EJB WAR deployment...
-
2. Re: Why is servlet mapping needed to deploy a web service?
nbhatia Oct 3, 2011 7:18 AM (in response to nickarls)I have found that putting @Stateless exposes a very complicated web service on GlassFish - it starts using WS-Transactions which means client has to support it too. Since I am trying to keep my codebase same across app servers, I would like to avoid @Stateless.
-
3. Re: Why is servlet mapping needed to deploy a web service?
asoldano Oct 12, 2011 4:46 AM (in response to nbhatia)Naresh Bhatia wrote:
I was trying to deploy the following web service on AS 7.0.2:
@WebService(targetNamespace = "http://archfirst.org/bfexch/marketdataservice.wsdl", serviceName = "MarketDataService")
public class MarketDataWebService {
...
}
This by itself was not working. I had to add the servlet mapping shown below to make it work (based on a suggestion in this article):
<servlet>
<servlet-name>MarketDataService</servlet-name>
<servlet-class>org.archfirst.bfexch.webservice.marketdata.MarketDataWebService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MarketDataService</servlet-name>
<url-pattern>/MarketDataService/*</url-pattern>
</servlet-mapping>
- Where is this documented? Is it specific to Apache CXF? I did not have to do this when deploying the same service on GlassFish. Perhaps Metro does not need it?
https://docs.jboss.org/author/display/JBWS/JAX-WS+User+Guide - POJO deployments
As suggested, you can have the endpoint as an EJB3 bean annoting it with @Stateless, that allows you to have no descriptors if packaging it into a jar archive.
- [...]
- Does AS 7 support multiple implementations of JAX-WS? The JBoss WS page suggests that there are 3 implementations, but it is not clear which one AS 7 uses.
JBossWS used to have 3 integration stacks. The project home page has to be updated, the JBossWS-Metro integration has been discontinuted.
I believe the fact JBoss AS 7 is using JBossWS-CXF (i.e. the JBossWS integration with Apache CXF) is mentioned in the doc, but I'll check.
The https://docs.jboss.org/author/display/JBWS doc, however, explicitely refers to JBoss AS 7 and hence JBossWS-CXF.
-
4. Re: Why is servlet mapping needed to deploy a web service?
asoldano Oct 12, 2011 4:47 AM (in response to nbhatia)WS-Transaction is not enabled by the default on a EJB3 WS endpoint deployed on JBoss AS, so your Glassfish client won't be forced to use WS-Transaction.
-
5. Re: Why is servlet mapping needed to deploy a web service?
nbhatia Oct 12, 2011 7:46 AM (in response to asoldano)Thanks Alessio. This is very helpful information.
Naresh
-
6. Re: Why is servlet mapping needed to deploy a web service?
nbhatia Oct 12, 2011 7:58 AM (in response to asoldano)To clarify, Glassfish will not be a client of the JBoss AS web service. I am trying to use the same source code to build a service that can be hosted on either Glassfish or JBoss AS. Thus you see that use of @Stateless is causing too much trouble in case of Glassfish. The only solution I have found is have the web service be a POJO and then inject a stateless bean for transactional behavior!
Naresh
(P.S. Of course, JBoss AS has its own quirks. I have not yet been able to figure out why a POJO is not being injected in a Web Service: see http://community.jboss.org/thread/173105)