jboss seam webservice
1. Write POJO-based implementation of Web Service:
@WebService public class TestService
{
@WebMethod public String test(){ //.... }
}
2. POJO code location in the META-INF directory with standard-jaxws-endpoint-config.xml, as follows:
<jaxws-config xmlns="urn:jboss:jaxws-config:2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
<endpoint-config>
<config-name>Seam WebService Endpoint</config-name>
<pre-handler-chains>
<javaee:handler-chain> <javaee:protocol-bindings>##SOAP11_HTTP</javaee:protocol- bindings>
<javaee:handler> <javaee:handler-name>SOAP Request Handler</javaee:handler-name> <javaee:handler-class>org.jboss.seam.webservice.SOAPRequestHandler</javaee:handler-class>
</javaee:handler>
</javaee:handler-chain>
</pre-handler-chains>
</endpoint-config>
</jaxws-config>
3. Registered in web.xml
<!-- Web Service -->
<servlet>
<servlet-name>TestService Servlet</servlet-name>
<servlet-class>test.TestService</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>TestService Servlet</servlet-name>
<url-pattern>/TestService</url-pattern>
</servlet-mapping>
4. Configure Web Service to access Seam components in components.xml file needs to do to add the following configuration statement:
xmlns: web = "http://jboss.com/products/seam/web"
And
http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd
In addition:
<web:context-filter url-pattern="/TestService/*"/>
5. WebService to access Seam components
TestSeamComp comp = (TestSeamComp) Component.getInstance("testSeamComp");
6. Access to the generated WSDL file
http://localhost:8080/jbossws/services
参照以上资料在一个seam框架的运用中添加webservice功能,但是在启动web服务器时报错:java.lang.ClassCastException: xxwebservice.TestService cannot be cast to javax.servlet.Servlet