soap方式调用webservice服务demo

来源:互联网 发布:linux db2创建schema 编辑:程序博客网 时间:2024/05/14 04:58
    /**     * 服务接口地址     */        @Value("${remote.target.net.gateway.url}")        private String              serviceUrl;@SuppressWarnings("rawtypes")public IResult demoFun(List<Integer> paramA, BigDecimal paramB) {        try {    //demo示例--ws soap请求    Map<String, Object> map = new HashMap<String, Object>();            map.put("paramA", paramA);            map.put("paramB", paramB.toString());            String json = GsonUtils.toJson(map);            logger.info("打印请求远程主机接口地址-->{},参数-->{}", serviceUrl, json);            RemoteAvailableService service = new RemoteAvailableService(new URL(serviceUrl));            RemoteAvailableServiceSoap soap = service.getRemoteAvailableServiceSoap();            RequestResult result = soap.doTargetFun(json);            logger.info("打印请求远程主机接口-->{},返回数据-->{}", "doTargetFun", GsonUtils.toJson(result));            if (result.getResult() == null) {                return DefaultResult.fail("******");            }    //com.alibaba.fastjson            List<Map<String, Object>> list = JSONObject.parseObject(result.getResult().toString(),new TypeReference<List<Map<String, Object>>>(){});            return DefaultResult.success(list);        } catch (Exception e) {            logger.error("******发生错误", e);            return DefaultResult.fail("******");        }    }


其它可参考:
1、用SOAP方式调用webservice
http://jackzlz.iteye.com/blog/1998346

2、WebService中的WSDL详解
http://blog.csdn.net/wenzhi20102321/article/details/68486526
0 0