0 Replies Latest reply on Apr 29, 2008 9:43 PM by Peter Pei Guo

    how to modify a client so that it works with rpc instead of

    Peter Pei Guo Newbie

      On server side, I changed the style annotation of my service: from RPC to DOCUMENT. The client side stopped working. When I first started writing this post, I found teh client side imports javax.xml.rpc.*. i searched through J2EE API and there is no javax.xml.document.

      How should I modify my client code? Why is the API's not consistent for those two styles?

      package org.jboss.tutorial.webservice.client;
      
      import org.jboss.tutorial.webservice.bean.Calculator;
      
      import javax.xml.namespace.QName;
      import javax.xml.rpc.Service;
      import javax.xml.rpc.ServiceFactory;
      import java.net.URL;
      import java.io.File;
      
      public class Client
      {
       public static void main(String[] args) throws Exception
       {
       URL url = new URL("http://localhost:8080/tutorial/CalculatorBean?wsdl");
      
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, null);
      
       Calculator calculator = (Calculator) service.getPort(Calculator.class);
      
       System.out.println("" + calculator.add(Integer.parseInt(args[0]), Integer.parseInt(args[1]), args[2]));
       System.out.println("" + calculator.subtract(Integer.parseInt(args[0]), Integer.parseInt(args[1])));
       }
      }