• webservice系统学习笔记2-使用jdk的命令生成本地代码


    使用jdk自带的命令wsimport生成远程服务的本地代码

    C:Documents and SettingsAdministrator>wsimport -d E:mhWorkspacewebservicesrccomyzlws02 -keep -verbose -p com.yzl.ws02 
    http://localhost:8888/ws01?wsdl


    -d <directory>       specify where to place generated output files(指定生成文件的路径)
    -verbose   output messages about what the compiler is doing(输出详细信息)
    -keep                keep generated files(生成java文件,不带此参数将只生成class文件)
    -p <pkg>             specifies the target package 生成代码的目标包

     执行上面的命令生成了如下代码

    编写测试类:

    public class Test {
    
        public static void main(String[] args) {
            MyServiceImplService service = new MyServiceImplService();
            IMyService client = service.getMyServiceImplPort();
            
            System.out.println(client.add(10, 20));
            System.out.println(client.login("test", "123456"));
            System.out.println(client.login("test", "111111"));
        }
    }

    我们常用的myeclipse生成webservice客户端其实也是基于这个命令生成的,在这里我们也看下具体的操作步骤

    1、

    2、

    3、然后下一步下一步就OK了,生成的代码和上面用命令生成的是一模一样的。

  • 相关阅读:
    Codeforces 946D
    Codeforces 817F
    Codeforces 931F
    Codeforces 932D
    Graph HDU
    Chef and Graph Queries CodeChef
    Lucky Array Codeforces
    Calculation 2 HDU
    洛谷 P3455 [POI2007]ZAP-Queries || 洛谷P2522,bzoj2301
    洛谷 P2398 GCD SUM || uva11417,uva11426,uva11424,洛谷P1390,洛谷P2257,洛谷P2568
  • 原文地址:https://www.cnblogs.com/yangzhilong/p/3282414.html
Copyright © 2020-2023  润新知