0 Replies Latest reply on May 9, 2006 9:55 AM by Julien Martin

    don't understand this: The service interface does not implem

    Julien Martin Expert

      Hello,
      I am trying to call a web service. I have the following code in my servlet:

      /*
       * ServletWSClient.java
       *
       * Created on 9 mai 2006, 12:32
       */
      
      package pack;
      
      import java.io.*;
      import java.net.*;
      
      import javax.servlet.*;
      import javax.servlet.http.*;
      
      /**
       *
       * @author Administrator
       * @version
       */
      public class ServletWSClient extends HttpServlet {
      
       /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
       * @param request servlet request
       * @param response servlet response
       */
       protected void processRequest(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
       response.setContentType("text/html;charset=UTF-8");
       PrintWriter out = response.getWriter();
       String s = null;
       try { // This code block invokes the myOperation operation on web service
       s = getEJBWebServiceOneSEIPort().myOperation("fsdqsqdsf");
       } catch(java.rmi.RemoteException ex) {
       ex.printStackTrace();
       } catch(Exception ex) {
       ex.printStackTrace();
       }
      
       out.println("<html>");
       out.println("<head>");
       out.println("<title>Servlet ServletWSClient</title>");
       out.println("</head>");
       out.println("<body>");
       out.println(s);
       out.println("<h1>Servlet ServletWSClient at " + request.getContextPath () + "</h1>");
       out.println("</body>");
       out.println("</html>");
      
       out.close();
       }
      
       // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
       /** Handles the HTTP <code>GET</code> method.
       * @param request servlet request
       * @param response servlet response
       */
       protected void doGet(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
       processRequest(request, response);
       }
      
       /** Handles the HTTP <code>POST</code> method.
       * @param request servlet request
       * @param response servlet response
       */
       protected void doPost(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
       processRequest(request, response);
       }
      
       /** Returns a short description of the servlet.
       */
       public String getServletInfo() {
       return "Short description";
       }
       // </editor-fold>
      
       private pack.EJBWebServiceOne getEJBWebServiceOne() {
       pack.EJBWebServiceOne eJBWebServiceOne = null;
       //System.out.println("-->"+eJBWebServiceOne.getClass().getInterfaces().toString());
      
       try {
       javax.naming.InitialContext ic = new javax.naming.InitialContext();
       eJBWebServiceOne = (pack.EJBWebServiceOne) ic.lookup("java:comp/env/service/EJBWebServiceOne");
       } catch(javax.naming.NamingException ex) {
       ex.printStackTrace();
       }
       return eJBWebServiceOne;
       }
      
       private pack.EJBWebServiceOneSEI getEJBWebServiceOneSEIPort() {
       pack.EJBWebServiceOneSEI eJBWebServiceOneSEIPort = null;
       try {
       eJBWebServiceOneSEIPort = getEJBWebServiceOne().getEJBWebServiceOneSEIPort();
       } catch(javax.xml.rpc.ServiceException ex) {
       ex.printStackTrace();
       }
       return eJBWebServiceOneSEIPort;
       }
      
      
      
      }
      
      
      


      Here is what I get:

      15:39:09,890 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.xml.rpc.JAXRPCException: The service interf
      ace does not implement javax.xml.rpc.Service: pack.EJBWebServiceOne]
      15:39:09,890 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1135)
      15:39:09,890 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:690)
      15:39:09,890 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
      15:39:09,890 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      15:39:09,890 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:351)
      15:39:09,890 INFO [STDOUT] at pack.ServletWSClient.getEJBWebServiceOne(ServletWSClient.java:84)
      15:39:09,890 INFO [STDOUT] at pack.ServletWSClient.getEJBWebServiceOneSEIPort(ServletWSClient.java:94)
      15:39:09,890 INFO [STDOUT] at pack.ServletWSClient.processRequest(ServletWSClient.java:32)
      15:39:09,890 INFO [STDOUT] at pack.ServletWSClient.doGet(ServletWSClient.java:59)
      15:39:09,890 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      15:39:09,890 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      15:39:09,890 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      15:39:09,890 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      15:39:09,890 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      15:39:09,890 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      15:39:09,890 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      15:39:09,906 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      15:39:09,906 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      15:39:09,906 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      15:39:09,906 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      15:39:09,906 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
      15:39:09,906 INFO [STDOUT] Caused by: javax.xml.rpc.JAXRPCException: The service interface does not implement javax.xml.rpc.Service: pack.EJBWebServiceOne
      
      15:39:09,906 INFO [STDOUT] at org.jboss.webservice.client.ServiceObjectFactory.getObjectInstance(ServiceObjectFactory.java:256)
      15:39:09,906 INFO [STDOUT] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      15:39:09,906 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1110)
      15:39:09,906 INFO [STDOUT] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1127)
      15:39:09,906 INFO [STDOUT] ... 29 more
      15:39:09,906 INFO [STDOUT] java.lang.NullPointerException
      15:39:09,906 INFO [STDOUT] at pack.ServletWSClient.getEJBWebServiceOneSEIPort(ServletWSClient.java:94)
      15:39:09,906 INFO [STDOUT] at pack.ServletWSClient.processRequest(ServletWSClient.java:32)
      15:39:09,906 INFO [STDOUT] at pack.ServletWSClient.doGet(ServletWSClient.java:59)
      15:39:09,906 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      15:39:09,906 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      15:39:09,906 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      15:39:09,906 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      15:39:09,906 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      15:39:09,906 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      15:39:09,906 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      15:39:09,906 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      15:39:09,906 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      15:39:09,906 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      15:39:09,906 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      15:39:09,906 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
      
      
      
      


      I am POSITIVE that the eJBWebServiceOne object implements javax.rpc.Service. because I checked it. Then what's wrong?

      Thanks in advance,

      Julien.