soap方式调用webservice服务demo


    /**
     * 服务接口地址
     */
        @Value("${remote.target.net.gateway.url}")
        private String              serviceUrl;
	@SuppressWarnings("rawtypes")
	public IResult demoFun(List paramA, BigDecimal paramB) {
        try {
	    //demo示例--ws soap请求
	    Map map = new HashMap();
            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> list = JSONObject.parseObject(result.getResult().toString(),new TypeReference>>(){});
            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

你可能感兴趣的:(soap方式调用webservice服务demo)