1 Reply Latest reply: Sep 14, 2012 9:08 AM by 945123 RSS

    Web Service Classpath vs Servlet Classpath

    945123
      I need to write a web service that will communicate with another web service and send back an enhanced response.
      The first step I took was to write a single servlet application that would communicate with the other web service and display the results.
      Here is the doGet from my servlet:
           public void doGet(HttpServletRequest request, HttpServletResponse response)
                throws IOException, ServletException {

                try {
                     // set up service input
                     int param = 400;

                     // invoke the service
                     String wsResult = performWebServiceCall(param);

                     // send web service output to browser
                     response.setContentType("text/html");
                     PrintWriter out = response.getWriter();
                     out.println("<html>" +
                          "\n<head>" +
                          "\n<title>Web Application WS Test</title>"+
                          "</head>" +
                          "<body>" +
                          "<center> <h1>"+
                          wsResult +
                          "</h1> </center>" +
                          "</body>" +
                          "\n</html>");

                } catch (Exception ex) {
                     PrintWriter out = response.getWriter();
                     out.println("An Exception has occured");
                     out.println(ex.getMessage());
                }
           }

      This all works.

      Now I want to use this from another web service, so I added this method to the servlet:
           public String getWebServiceVal(int num) {
                String wsResult = null;

                try {
                     // invoke the service
                     wsResult = performWebServiceCall(num);
                } catch (Exception ex) {
                     System.out.println(ex.getMessage());
                }

                return wsResult;
           }

      Created a web service:
           @WebService(name="WebServiceTestWSPortType", serviceName="WebServiceTestWSService")
           public class WebServiceTestWSImpl {

                // By default, all public methods are exposed as Web Services operation
                public String getResponse(int inputNumber) {
                     String wsResult = null;
                     try {

                          WebAppTestWS tws = new WebAppTestWS();
                          wsResult = tws.getWebServiceVal(inputNumber);

                     } catch (Exception ex) {
                          ex.printStackTrace();
                     }

                     return "getResponse:" + wsResult;
                } // end public String getResponse
           } // end public class WebServiceTestWSImpl


      But when I try to run the web service test page in weblogic, I get this error:
      getResponse:weblogic client internal deployment descriptor bmv/interfaces/L1IdentitySolutions/photos/classes/Service_internaldd.xml not found. Please make sure all clientgen generated files are in the classpath.

      After reading this:
      http://docs.oracle.com/cd/E11035_01/wls100/programming/classloading.html
      I tried moving the single servlet and the web service to one application ear file, thinking that would force them to share the same classloaders, but I still get the same error.
      The file is in the classpath when the servlet needs it, but not if I try to use the web service test page in weblogic.

      It seems like a simple issue that I just don't understand.
      Any help or pointers are greatly appreciated.
      Thank you.