项目中调用webservice接口

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35917800/article/details/88400354

根据wsdl生成接口代码,使用jdk自带的wsimport,cmd到jdk/bin安装目录下:
wsimport -keep -p com.demo.client -s D:\temp http://106.14.197.163:8017/BaseInfoService.svc?wsdl
得到代码:
在这里插入图片描述
找到BaseInfoService和IBaseInfoService,可以看到IBaseInfoService接口里有需要调用的方法:
在这里插入图片描述
调用方法如下:

public class Demo {
    public static void main(String[] args) {
        BaseInfoService baseInfoService = new BaseInfoService();
        IBaseInfoService iBaseInfoService = baseInfoService.getBasicHttpBindingIBaseInfoService();
        String input = "{\"RequestObjectList\":[{\"SERIES\": \"4100000621\",\"MEDIA_LEAD_ID\": \"27625523-165b-45b4-811b-bc5f0421f938\",\"CUSTOMER_NAME\": \"张三\",\"Adcode\":\"00000000-0000-0000-0000-00000000\",\"FK_DEALER_ID\": \"1100029501\",\"USER_KEY\": \"H5TOGMMC\",\"URL\": \"http://www.didapinche.com/static/h5/zhuanche/activity/sanling/index.html\",\"MOBILE\": \"16069302402\",\"LEAD_TYPE\": \"23720380-1553-482a-ad90-376399d6d7f8\"}],\"Key\":\"H5TOGMMC2\"}";
        String result = iBaseInfoService.sendSalesLeads(input);
        System.out.println(result);
    }
}

猜你喜欢

转载自blog.csdn.net/qq_35917800/article/details/88400354
今日推荐