Web Service call from JSP

Discussions

XML & Web services: Web Service call from JSP

  1. Web Service call from JSP (3 messages)

    I make a Web service on JBuilder, I make a client that use it and all works fine, What I want to know is how to call that web service from a JSP.

    This is the client:

      public static void main(String[] args) {
        try {
          String wsdlUrl = "http://localhost:7001/web-services/SocioSession?WSDL";
          SocioSession service = new SocioSession_Impl(wsdlUrl);
          SocioSessionPort port = service.getSocioSessionPort();
          //call to get a employee
          EmployeeInfo[] employees = port.getAllEmployees(601620454);
    //extract information from the array.
          for (int i = 0; i < employees.length; i++) {
            //check to see if any nulls are being returned from the database.
            if (employees[i] != null) {
              //if not null, print out the full name of the employee.
              System.out.println(employees[i].getNomNombre());
              System.out.println(employees[i].getNomApellido1());
              System.out.println(employees[i].getNomApellido2());
            }
          }
        }
          catch (ServiceException ex) {
            ex.printStackTrace();
          }
          catch (IOException ex) {
            ex.printStackTrace();
          }

        }

    How can I do this with a JSP, i'm using JBuilder + weblogic 8.1, I don't want to use any .jar of weblogic, because I want it to works if in the future we change the application server, thanks.
    Regards Daniel

    Threaded Messages (3)

  2. Web Service call from JSP[ Go to top ]

    Put all the jars used by your web service client in your JSP's WEB-INF/lib directory. You logic should then work in the JSP.
  3. Web Service call from JSP[ Go to top ]

    How can I put the .jar in the WEB-INF\lib, if I do manually (copy and paste) when i rebuild the project JBuilder errase it??

    Someone tell me that I can make a server with the client code and call the methods of the server (get y set) from the JSP, someone have an example code of that??

    Any other idea??

    Regards Daniel
  4. Web Service call from JSP[ Go to top ]

    Export your project out of JBuilder, and try to get it to work from a command-line java invocation.

    Until you can get the command-line program to work outside of JBuilder, don't bother to try to get it to work inside the (much more complicated) server environment. Once you have figured out what jars you need in your classpath to get things to work outside of JBuilder, put those same jars in your web application's WEB-INF/lib directory.