Create a webService client and a webservice Client

Source: Internet
Author: User

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 );}




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.