2 Replies Latest reply on Oct 19, 2007 2:08 AM by fei wang

    Please help on invoking the jboss WS?

    fei wang Newbie

      I recently met the problem when I use the jbossWS. I use the jboss 4.2 AS and jbossws2.0GA, jdk1.5.07

      Here is my code
      package tv.blackarrow.integration.twc.ws;

      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebResult;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;


      /**
      * This class was generated by the JAX-WS RI.
      * JAX-WS RI 2.1.1-b03-
      * Generated source version: 2.0
      *
      */
      @WebService(name = "Hello", targetNamespace = "http://ws.twc.integration.blackarrow.tv/")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public interface Hello {


      /**
      *
      * @param arg0
      * @return
      * returns java.lang.String
      */
      @WebMethod
      @WebResult(partName = "return")
      public String echo(
      @WebParam(name = "arg0", partName = "arg0")
      String arg0);

      }


      package tv.blackarrow.integration.twc.ws;

      import javax.jws.WebMethod;
      import javax.jws.WebParam;
      import javax.jws.WebResult;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;

      @javax.jws.WebService(endpointInterface="tv.blackarrow.integration.twc.ws.Hello")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class HelloImpl implements Hello{
      @WebMethod
      public String echo(String input)
      {
      System.out.println("This is echo of"+input);
      return input;
      }
      }


      client side

      ackage tv.blackarrow.integration.twc.wsclient;

      import java.net.MalformedURLException;
      import java.net.URL;
      import javax.xml.namespace.QName;
      import javax.xml.ws.Service;
      import javax.xml.ws.WebEndpoint;
      import javax.xml.ws.WebServiceClient;
      import tv.blackarrow.integration.twc.ws.*;

      /**
      * This class was generated by the JAX-WS RI.
      * JAX-WS RI 2.1.1-b03-
      * Generated source version: 2.0
      *
      */
      @WebServiceClient(name = "HelloService", targetNamespace = "http://ws.twc.integration.blackarrow.tv/", wsdlLocation = "http://localhost:8080/baapi/hello?wsdl")
      public class HelloService
      extends Service
      {

      private final static URL HELLOSERVICE_WSDL_LOCATION;

      static {
      URL url = null;
      try {
      url = new URL("http://localhost:8080/baapi/hello?wsdl");
      } catch (MalformedURLException e) {
      e.printStackTrace();
      }
      HELLOSERVICE_WSDL_LOCATION = url;
      }

      public HelloService(URL wsdlLocation, QName serviceName) {
      super(wsdlLocation, serviceName);
      }

      public HelloService() {
      super(HELLOSERVICE_WSDL_LOCATION, new QName("http://ws.twc.integration.blackarrow.tv/", "HelloService"));
      }

      /**
      *
      * @return
      * returns Hello
      */
      @WebEndpoint(name = "HelloPort")
      public Hello getHelloPort() {
      return (Hello)super.getPort(new QName("http://ws.twc.integration.blackarrow.tv/", "HelloPort"), Hello.class);
      }

      }

      package tv.blackarrow.integration.twc.wsclient;
      import tv.blackarrow.integration.twc.ws.*;
      public class HelloClient {


      public static void main(String args[])
      {
      if (args.length != 1)
      {
      System.err.println("usage: EchoClient ");
      System.exit(1);
      }

      HelloService service = new HelloService();
      Hello echo = service.getHelloPort();
      System.out.println("Server said: " + echo.echo(args[0]));
      }

      }

      Here is my web.xml setting

      <servlet-name>HelloService</servlet-name>
      <servlet-class>tv.blackarrow.integration.twc.ws.Hello</servlet-class>
      <load-on-startup>1</load-on-startup>


      <servlet-mapping>
      <servlet-name>HelloService</servlet-name>
      <url-pattern>/hello/*</url-pattern>
      </servlet-mapping>


      Here is the wsdl


      ?



      ?



      ?

      ?





      ?

      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      ?

      <soap:operation soapAction=""/>
      ?

      <soap:body namespace="http://ws.twc.integration.blackarrow.tv/" use="literal"/>

      ?

      <soap:body namespace="http://ws.twc.integration.blackarrow.tv/" use="literal"/>



      ?

      ?

      <soap:address location="http://127.0.0.1:8080/baapi/hello"/>




      when I run the wsrunclient to invoke the client, it shows
      [Fatal Error] :-1:-1: Premature end of file.
      Server said: null

      I check with the jboss log,
      20:42:17,955 INFO [LifecycleHandlerImpl] WebService started: http://127.0.0.1:8080/baapi/hello

      20:43:25,799 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
      java.lang.ClassCastException: org.jboss.ws.core.soap.EnvelopeBuilderDOM
      at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:252)
      at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:179)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:377)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:260)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:177)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:110)
      at org.jboss.wsf.spi.invocation.EndpointServlet.service(EndpointServlet.java:72)
      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:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:613)
      20:43:25,807 ERROR [SOAPFaultHelperJAXWS] Error creating SOAPFault message
      javax.xml.soap.SOAPException: java.lang.ClassCastException: org.jboss.ws.core.soap.MessageFactoryImpl
      at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:77)
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.toSOAPMessage(SOAPFaultHelperJAXWS.java:231)
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:161)
      at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
      at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:645)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:418)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:260)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:177)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:110)
      at org.jboss.wsf.spi.invocation.EndpointServlet.service(EndpointServlet.java:72)
      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:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:613)
      Caused by: java.lang.ClassCastException: org.jboss.ws.core.soap.MessageFactoryImpl
      at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:73)
      ... 28 more
      20:43:25,808 ERROR [RequestHandlerImpl] Error processing web service request
      org.jboss.ws.WSException: javax.xml.ws.WebServiceException: Cannot create SOAPFault message for: java.lang.ClassCastException: org.jboss.ws.core.soap.EnvelopeBuilderDOM
      at org.jboss.ws.WSException.rethrow(WSException.java:68)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:298)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:177)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:110)
      at org.jboss.wsf.spi.invocation.EndpointServlet.service(EndpointServlet.java:72)
      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:230)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:613)
      Caused by: javax.xml.ws.WebServiceException: Cannot create SOAPFault message for: java.lang.ClassCastException: org.jboss.ws.core.soap.EnvelopeBuilderDOM
      at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:169)
      at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:104)
      at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:645)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:418)
      at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:260)
      ... 22 more


      Please help!!! thanks a million

        • 1. Re: Please help on invoking the jboss WS?
          fei wang Newbie

          I clean up my war fle lib, remove all the jboss ws related jar file, seems the exception changed to

          java.lang.IllegalStateException: Canot get target bean instance
          at org.jboss.wsf.spi.invocation.InvocationHandlerJSE.getTargetBean(InvocationHandlerJSE.java:54)
          at org.jboss.wsf.stack.jbws.ServiceLifecycleInvocationHandler.invoke(ServiceLifecycleInvocationHandler.java:47)
          at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:206)
          at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:396)
          at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:260)
          at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:177)
          at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:110)
          at org.jboss.wsf.spi.invocation.EndpointServlet.service(EndpointServlet.java:72)
          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:230)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
          at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
          at java.lang.Thread.run(Thread.java:613)
          Caused by: java.lang.InstantiationException: tv.blackarrow.integration.twc.ws.Hello
          at java.lang.Class.newInstance0(Class.java:335)
          at java.lang.Class.newInstance(Class.java:303)
          at org.jboss.wsf.spi.invocation.InvocationHandlerJSE.getTargetBean(InvocationHandlerJSE.java:49)