java WebService请求

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

/**
* WebService请求
* @return
*/
private static String xinDaWebServiceReq(String meth,String xml){
String result = null;
String xmlData ="<?xml version=\"1.0\" encoding=\"GBK\"?>"+xml;
try {
logger.info("请求数据:"+xmlData);
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(Global.getConfig("xinda_WSDL"));//
            logger.info("xinda_WSDL:"+Global.getConfig("xinda_WSDL"));
            call.setOperationName(meth);//WSDL里面描述的接口名称  "sayHi"
            logger.info("meth:"+meth);
            //设置响应超时时间为30秒
            call.setTimeout(1000*30);
            //给方法传递参数,并且调用方法
            result = (String)call.invoke(new Object[]{xmlData,InstonyMd5Encrypt.md5(Global.getConfig("xinda_key")+xmlData.trim())});//"xindaeiestest"
            logger.info("签名种子:"+Global.getConfig("xinda_key"));
            logger.info("加密后: "+InstonyMd5Encrypt.md5(Global.getConfig("xinda_key")+xmlData.trim()));
            logger.info("响应数据:"+result);
        }catch (Exception e) {
        logger.info(e.toString());
        }
return result;
}

猜你喜欢

转载自guoyulong005.iteye.com/blog/2362211
今日推荐