Create a webService client and a webservice Client
II. Create a client
(1) Export the server-side interface jar file. Export the previously created server-side interface file as a jar package and introduce it to the created client test project. (Note: The export interface file level is too deep. I can right-click the export interface class to export the jar file, and then introduce it to the client test project)
(2) introduce the XFire jar package. (I introduced 8 packages)
(3) create the object classes stored in the collection, that is, the javaBean corresponding to your stored data
(4) create a servlet to call the service.
Service serviceModel = new ObjectServiceFactory (). create (interface name. class); XFire xfire = XFireFactory. newInstance (). getXFire (); XFireProxyFactory factory = new XFireProxyFactory (xfire); String serviceUrl = "service address"; // "http: // localhost: 8080/res2/services/allresfood "; note: "? Wsdl "ResfoodWebService client = null; try {client = (ResfoodWebService) factory. create (serviceModel, serviceUrl);} catch (Exception e) {System. out. println ("Client call webservice has exception:" + e. toString ();} List <Resfood> list = client. findByPage (); for (Resfood rf: list) {System. out. println (rf );}