I have written a simple hello application in Axis2 JAX-WS and when I run my
client I am getting an error that the service class cannot be found. In this
email I'm including the exact message, my services.xml file, a jar output of
my aar file, my wsdl file, my schema file, a snippet from the available
services webpage and a stacktrace from catalina.out.
I wrote the services.xml, the schema and the wsdl files by hand and
generated all the classes (except HelloClient, my client class) by "wsimport
-keep -verbose hello.wsdl".
I have tried every Google search I can think of and have looked at several
tutorials and dozens of mail archives without finding out the answer. If you
can help, I would really appreciate it.
------------------------------------------------------------------------------------------------------------------------------------------------------
The error message I get when I run the client (java -cp HelloService.jar
com/wb/hello/HelloClient) is:
"Exception in thread "main" javax.xml.ws.soap.SOAPFaultException:
java.lang.RuntimeException: The service class cannot be found for this
AxisService."
------------------------------------------------------------------------------------------------------------------------------------------------------
My services.xml file is simple:
<service name="HelloService">
<parameter name="ServiceClass">com.wb.hello.HelloService</parameter>
<operation name="hello">
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/>
</operation>
</service>
------------------------------------------------------------------------------------------------------------------------------------------------------
When I go to /cygdrive/c/tomcat-6.0.20/webapps/axis2/WEB-INF/services and
jar the aar file, the service class is there:
$ jar tvf HelloService.aar
0 Tue Jan 26 14:41:52 PST 2010 META-INF/
71 Tue Jan 26 14:41:52 PST 2010 META-INF/MANIFEST.MF
1287 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloClient.class
886 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloPort.class
898 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloPortType.class
752 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloRequestType.class
758 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloResponseType.class
2079 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloService.class
1708 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/ObjectFactory.class
230 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/package-info.class
1794 Tue Jan 26 14:41:50 PST 2010 META-INF/hello.wsdl
805 Tue Jan 26 14:41:50 PST 2010 META-INF/helloSchema.xsd
301 Tue Jan 26 14:41:36 PST 2010 META-INF/services.xml
------------------------------------------------------------------------------------------------------------------------------------------------------
My wsdl file is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions targetNamespace="com/wb/hello"
name="hello"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="com/wb/hello"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" >
<!-- define schema elements for helloRequest, helloResponse -->
<types>
<xsd:schema>
<xsd:import namespace="com/wb/hello"
schemaLocation="helloSchema.xsd"/>
</xsd:schema>
</types>
<!-- define messages for helloRequest, helloResponse elements -->
<message name="helloRequestMessage">
<part name="name" element="tns:helloRequestElement"/>
</message>
<message name="helloResponseMessage">
<part name="result" element="tns:helloResponseElement"/>
</message>
<!-- define port for helloRequest, hello Response messages -->
<portType name="helloPort">
<operation name="hello">
<input message="tns:helloRequestMessage"/>
<output message="tns:helloResponseMessage"/>
</operation>
</portType>
<!-- define binding for hello operation -->
<binding name="helloBinding" type="tns:helloPort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<operation name="hello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<!-- finally, define the service -->
<service name="HelloService">
<port name="helloPort" binding="tns:helloBinding">
<soap:address location="
http://localhost:8080/axis2/services/HelloService"/>
</port>
</service>
</definitions>
------------------------------------------------------------------------------------------------------------------------------------------------------
My schema file is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsd:schema targetNamespace="com/wb/hello"
xmlns:tns="com/wb/hello"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- define types for helloRequest, helloResponse -->
<xsd:complexType name="helloRequestType">
<xsd:sequence>
<xsd:element name="request" type="xsd:string" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="helloResponseType">
<xsd:sequence>
<xsd:element name="response" type="xsd:string" minOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<!-- define elements for helloRequest, helloResponse -->
<xsd:element name="helloRequestElement" type="tns:helloRequestType"/>
<xsd:element name="helloResponseElement" type="tns:helloResponseType"/>
</xsd:schema>
------------------------------------------------------------------------------------------------------------------------------------------------------
When I point my browser to
http://localhost:8080/axis2/services/listServicesit shows it as
available:
Back Home <http://localhost:8080/axis2/axis2-web/index.jsp> |
Refresh<http://localhost:8080/axis2/#>
Available services
HelloService<http://localhost:8080/axis2/services/HelloService?wsdl>
Service
EPR : http://localhost:8080/axis2/services/HelloService
Service Description : HelloService *Service Status : Active*
*Available Operations*
- hello
------------------------------------------------------------------------------------------------------------------------------------------------------
And for what it's worth, /cygdrive/c/tomcat-6.0.20/logs/catalina.out
includes:
[ERROR] The service class cannot be found for this AxisService.
java.lang.RuntimeException: The service class cannot be found for this
AxisServi
ce.
at
org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessa
geReceiver.java:95)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq
uest(HTTPTransportUtils.java:167)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1
42)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ss(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:45
4)
at java.lang.Thread.run(Thread.java:619)