I am trying to follow the docs at
http://jbws.dyndns.org/mediawiki/index.php/JAX-WS_User_Guide#Top-Down_.28...
to create a Web service using the top-down method. What I did was first use the bottom-up
method, and after deploying the Web service, I ran wsprovide to create the WSDL. In
addition, I wrote a client that that accessed the Web service to ensure that it works. So
far so good.
Then I used wsconsume to create the Java stubs, using the interface that was generated to
write my Web service endpoint class, packaged the necessary classes, web.xml and wsdl in a
war file and deployed it. Now when I access the endpoint with my client, I get an error
because the container is attempting to instantiate the interface, not the implementation
class.
My Web service looks exactly like the one in the documentation, with a few changes:
1) When I created the original bottom-up endpoint, I added the
@SOAPBinding(style=SOAPBinding.Style.RPC) annotation to it. Thus when the wsconsume
generated the stubs from the WSDL, I got only two classes: Echo.java and
EchoService.java.
2) Since I wanted to use the original WSDL, I modified the generated Echo.java to
reference the WSDL that I packaged in the war file (without this change, JBossWS will
re-generate the WSDL when the web service is deployed, which sort of defeats the whole
purpose of top-down development; I could never figure out if there was a default WSDL
location; and this property was ignored when I placed it on the implementation class):
@WebService(name="Echo", targetNamespace = "http://echo/",
wsdlLocation="WEB-INF/wsdl/EchoService.wsdl")
My war file has the following contents:
WEB-INF/classes/echo/Echo.class
WEB-INF/classes/echo/EchoImpl.class
WEB-INF/web.xml
WEB-INF/wsdl/EchoService.wsdl
When I run my client, I get the following error on the server:
09:07:10,941 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.InstantiationException: echo.Echo
at java.lang.Class.newInstance0(Class.java:335)
at java.lang.Class.newInstance(Class.java:303)
at
org.jboss.ws.core.server.ServiceEndpointInvokerJSE.createServiceEndpoint(ServiceEndpointInvokerJSE.java:69)
at
org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:130)
at
org.jboss.ws.core.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:204)
at
org.jboss.ws.core.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:440)
at
org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at
org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:86)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:595)
By the way, I am running JBossWS 1.2 on JBoss AS 5.0 beta2 (pulled on March 5th)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030294#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...