[jboss-user] [JBoss Web Services] New message: "Re: JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy"

Jan Uhlir do-not-reply at jboss.com
Tue Jan 12 06:49:08 EST 2010


User development,

A new message was posted in the thread "JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy":

http://community.jboss.org/message/519483#519483

Author  : Jan Uhlir
Profile : http://community.jboss.org/people/espinosa_cz

Message:
--------------------------------------------------------------
Is you class annotated with @WebService? That is what deployment scanner is looking for. Your service definitively does not have to be a Servlet subclass. I wonder if you need web.xml at all, in theory the annotation is all you need, everything else can be generated and defaulted reasonably for you.
 
Here is my working example. POJO service class, JBoss 5.1.0.GA, Maven project, WAR archive.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" ....>
    <servlet>
        <servlet-name>MyWebService</servlet-name>
        <servlet-class>esp.home.wsarena.service.FooService</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MyWebService</servlet-name>
        <url-pattern>/FooService</url-pattern>
    </servlet-mapping>
</web-app>

 
jboss-web.xml  (not essential just to have a nice context root):
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <!-- Exist here for sole reason of defining context root. There is no way how to do it in web.xml. This this JBoss specific way.
     Glassfish has a similar configuration file where you can do the same.
     Alternatives: 
     - make EAR file and specify context root for the web module in standard application.xml file.
     - make it EJB JAR file. But WebService must be also an EJB3 then. Then there is no context root (?)
     see: http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch06.html
     -->
    <context-root>wsarena3</context-root>
</jboss-web>
 
FooService.java
/**
 * Web service implementation
 */
@WebService
public class FooService {
    public static final Logger log = Logger.getLogger(FooService.class.getName());
    
    @WebMethod
    public void fooMethod1(String command) {
        log.info("fooMethod2: " + command);
    }
    
    @WebMethod
    public String fooMethod2(String command) {
        log.info("fooMethod2: " + command);
        return "OK";
    }
}

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519483#519483




More information about the jboss-user mailing list