关于java httpClient的问题,两个系统对接为什么接收不到信息?
我们有2个公司系统要对接一下,当我们这边数据发生变化时Controller 会对对方的Controller ,并不是推送到页面。发生推送数据操作,请问是否该使用httpClient,还是使用别的方法,。。版本3.0.1
本人使用了httpClient,在自己本机测试没问题,但是测试同事机器时,对面接收不到信息。或者说直接没有访问对方的方法,。。
代码
    public static String setUeventsend(ueventid){
        def uevent=UEvent.get(ueventid)
        HttpClient       httpClient   = new HttpClient();
        HttpClientParams clientParams = new HttpClientParams();
        String strResponse = "";
        def url=Apiurl.list()
        PostMethod method  = new PostMethod(url[0].url)
        def md5=new MD5()
        def getmd=md5.GetMD5Code(uevent.orderNo)
        NameValuePair[] data =[
            new NameValuePair("CLIENT_ID", uevent.clientcmy.id.toString()),
            new NameValuePair("CONTENT",  uevent.content.toString()),
            new NameValuePair("COORDINATOR_ID",  uevent?.coordinator?.id.toString()),
            new NameValuePair("DATE_ACCEPTED",  uevent.dateAccepted.toString()),
            new NameValuePair("DATE_CLOSED",  uevent.dateClosed.toString()),
            new NameValuePair("DATE_CREATED",  uevent.dateCreated.toString()),
            new NameValuePair("DATE_FINISHED",  uevent.dateFinished.toString()),
            new NameValuePair("EVENT_TYPE_ID",  uevent?.eventType?.id.toString()),
            new NameValuePair("MALUATION_ID",  uevent?.maluation?.id.toString()),
            new NameValuePair("REQUEST_TYPE",  uevent.requestType.toString()),
            new NameValuePair("STATE",  uevent.state.toString()),
            new NameValuePair("TITLE",  uevent.title.toString()),
            new NameValuePair("ADDRESS",  uevent.address.toString()),//应该必填
            //new NameValuePair("PROCESSOR_ID", uevent.clientcmy),
            new NameValuePair("OPERATOR_ID",  uevent.operator.id.toString()),
            new NameValuePair("ORDER_NO",  uevent.orderNo.toString()),
            new NameValuePair("EVENT_PRIORITY",  uevent.eventPriority.toString()),
            new NameValuePair("CREATER_ID",  uevent.creater.toString()),
            new NameValuePair("CLIENTCMY_ID",  uevent.clientcmy.id.toString()),
            new NameValuePair("CLIENTDPT_ID",  uevent.clientdpt.id.toString()),
            new NameValuePair("CREATERCMY_ID",  uevent.creatercmy.id.toString()),
            new NameValuePair("CREATERDPT_ID",  uevent.operator.id.toString()),
            new NameValuePair("OPERATORCMY_ID",  uevent.operatorcmy.id.toString()),
            new NameValuePair("OPERATORDPT_ID",  uevent.operatordpt.id.toString()),
            new NameValuePair("U_EVENT_PROGRESS",  uevent.uEventProgress.toString()),
            new NameValuePair("EVENT_MARK",  '1'),
            new NameValuePair("EQUIPMENT_TOTAL",  uevent.equipmentTotal.toString()),
            new NameValuePair("DATE_ACTIVE",  uevent.dateActive.toString()),
            new NameValuePair("DATE_ASSIGN",  uevent.dateAssign.toString()),
            new NameValuePair("DATE_CLAIM",  uevent.dateClaim.toString()),
            new NameValuePair("DATE_HUNG",  uevent.dateHung.toString()),
            new NameValuePair("DATE_UPGRADE",  uevent.dateUpgrade.toString()),
            new NameValuePair("SIGN",  getmd.toString())
        ]
        method.setRequestBody(data);
        try {
            httpClient.getParams().setContentCharset("GBK");
            // 执行postMethod
            int statusCode = httpClient.executeMethod(method);
            // HttpClient对于要求接受后继服务的请求,象POST和PUT等不能自动处理转发
            // 301或者302
            //    if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY
            //      || statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
            //     String responseBody = postMethod.getResponseBodyAsString();
            //     log.info(responseBody);
            //     if (responseBody != null) {
            //      if ("succ".equals(responseBody)) { // 发送成功
            //
            //       isSended = true;
            //      }
            //     }
            //    }
            if (statusCode == 200) {
                strResponse = method.getResponseBodyAsString();
            }
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (HttpException e) {
            // 发生致命的异常,可能是协议不对或者返回的内容有问题
            e.printStackTrace();
        } catch (IOException e) {
            // 发生网络异常
            e.printStackTrace();
        } finally {
            // 释放连接
            method.releaseConnection();
        }
        return strResponse;
}
 所有回答列表(3)
所有回答列表(3)
				- 等 最代码怎么获取牛币啊?
- 完 谁来告诉我最代码上线的时间,答对者给5牛币,先来先得
- 等 牛友们,大家好,你们做程序员多久了?现在还好吗?
- 完 在微信打开的页面里进行app下载
- 等 最代码2014年欢乐聚声会
- 完 mysql如何查询表数据并且对3个字段降序的SQL?
- 完 最代码牛币机制改革
- 完 成功的在bae上使用了自定义运行环境 jetty+nginx的组合,大家对jetty+nginx优化有哪些心得?
- 完 进来分享一下各位牛牛是如何加入最代码大家庭的?
- 等 为什么java BufferedImage类处理大图直接抛出内存溢出的异常?
- 等 最代码是否开发手机app客户端?
- 完 java程序员学习哪些java的技术?java有哪些框架?都能做哪方面的开发?
- 等 php格式网页文件怎么运行?
- 等 Java volatile值获取的问题
- 等 前端vue,拦截了登录后台后,返回的token,requests拦截token,但是发送请求的时候,就出现跨越异常
- 等 大专本科计算机科班怎么找到Java工作?
- 等 eclipse怎么把三个java swing游戏项目合成一个项目?
- 完 伙伴们,大家都有什么好的解压方式么,分享一下~
- 完 三四线城市,6、7k,运维工作,索然无味,想去辞职上培训,各位牛牛有什么建议嘛
- 等 jsp页面输入中文变成问号
- 等 JPA在线上运行一段时间后报错Caused by: java.lang.IncompatibleClassChangeError: null
- 等 PHP 这个规则用preg_match_all怎么写
- 等 大佬们,有没有知道Alfresco如何配置LDAP登录呢?
- 等 php的install目录是框架带的吗?
 相关问答
相关问答
				 最近浏览
最近浏览
				





 
                 
                