2 Replies Latest reply on Mar 27, 2007 12:03 PM by peterj

    Top-down development problem

    peterj

      I am trying to follow the docs at http://jbws.dyndns.org/mediawiki/index.php/JAX-WS_User_Guide#Top-Down_.28Using_wsconsume.29 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)

        • 1. Re: Top-down development problem
          zauberlehrling

          My understanding is the following:


          1.......... wsconsume .......... 2 ........ wsprovide ...... 3
          WSDL --------------------> Java --------------------> WSDL
          ................. top-down.......................... bottom-up


          Are the WSDL-files under 1 and 3 identical? Wich WSDL have you used for
          creating the client?

          One remark: The interface is not necessary for the webservice. isn't it.
          Second remark: The default webservice is a document-style webservice.
          The message sent or received by a document-style webservice are
          different to messages sent or received by a rpc-style webservice.

          Interface:...........................Echo.java
          Class used for a clients: .Echoservice.java

          Best regards!

          • 2. Re: Top-down development problem
            peterj