The Wsimport method of the JDK implements the WebService client invoke service

Source: Internet
Author: User

1. Configure the JDK environment, open the command line, enter Wsimport carriage return can see many parameters of the command,

-S: the storage path to generate client code

-P: New packaging of generated code

These two are most commonly used.

On the command line that opens, enter: Wsimport-s/home/medees/test http://10.90.2.17:6789/hello?wsdl

-S is followed by the place where the client code is generated, and the last parameter is the publish address plus the WSDL

2. Here is the directory of my Build:

  

3. Copy the generated code package to the project, and mine is the folder generated in the test directory.

4. Create a new client project, copy the generated client code to the project SRC directory, the new class can be called directly, just like a local call

 Package com.mess;  Public class testserviceclient {    publicstaticvoid  main (string[] args) {        Helloserviceimplservice HS=new  helloserviceimplservice ();        Helloserviceimpl  HSI=hs.gethelloserviceimplport ();        String message=hsi.sayhello ("John Doe");        SYSTEM.OUT.PRINTLN (message);}    }

The output is:, the client call succeeds!

The Wsimport method of the JDK implements the WebService client invoke service

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.