WebService client (created by command)

Source: Internet
Author: User
Tags wsdl

Generate the WebService client as a command:

Create a project item, the client project name Ws_client, enter the JDK bin directory in the CMD interface, enter the following command

Full format:

C:\Program files\java\jdk1.7.0_80\bin>wsimport-keep-p com.javen.service-d D:\
\WORKSPACEFOREWF\WS_CLIENT\SRC http://localhost:8091/WS_WebService/server/web-publish?wsdl

The following status appears after the carriage return to indicate success!

-p com.javen.service is stored in the server synchronization code, Com.javen.service can define their own

-D d:\\workspaceforewf\ws_client\src (the absolute path of the client) puts the server's synchronized code into the client's SRC directory

HTTP://LOCALHOST:8091/WS_WEBSERVICE/SERVER/WEB-PUBLISH?WSDL, the rest of this is the service-side WSDL connection.

After success, create a test class that tests to see if data can be obtained from the server:

@Test Public voidSelectnameall () {Try{iuserservice Iuserservice=NewUserserviceimplservice (). Getuserserviceimplport (); List<User> User =Iuserservice.selectall ();  for(User user2:user) {System.out.println ("Name:" +user2.getusername ()); }        } Catch(Exception e) {System.err.println (E.getmessage ()); System.err.println ("Connection is denied, check whether the server is started or connected correctly"); }            }

WebService client (created by command)

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.