Cognos reportnet开启权限认证针对空报表拆分产生的exception是不同的

未开启权限认证时,即不需要执行ContentManagerService_Port.logon时,抛出的exception可以通过如下代码段来捕获并解析:
catch (RemoteException e) {
                // 报表拆分时,没有数据的情况.
                if(e instanceof com.cognos.org.apache.axis.AxisFault){
                               AxisFault af = (AxisFault) e;
                               Element tmp[] = af.getFaultDetails();
                               String dataNot = "We are always supposed to have a grouping for each burst";
                        for (int i = 0; i < tmp.length; i++) {
                                Element ele = (Element) tmp[i];
                                NodeList nl = ele.getElementsByTagName("ns1:messageString");
                                // 判断是否为错误
                                if(nl == null || nl.getLength()<2){
                                        // 为错误
                                        logger.debug("NodeList length:"+nl.getLength());
                                }else{
                                        //判断是否为报表没有数据
                                        if(nl.item(1).getFirstChild().getNodeValue().indexOf(dataNot)!= -1){
                                                // 报表没有数据
                                                logger.warn("报表没有数据! " + cognosPath);            
                                                return true;
                                        }
                                }
                            }
                    }                    
                logger.error("调用cognos报表运行服务超时。错误:" + e.getMessage(),e);//经常出错
                e.printStackTrace();
                            return false;
        }


如果开启权限认证的情况下,即需要执行ContentManagerService_Port.logon才能连接cognos server成功。
ele.getElementsByTagName("ns1:messageString")返回的是空list,
ele.getElementsByTagName("*")返回一个length为6个list,其中有两个item有意义,如下:
<ns1:message>
        <messageString>
                RSV-SRV-0040 An application error has occurred. Please contact your Administrator.
</messageString>
</ns1:message>
<ns1:message>
        <messageString>
                DPR-ERR-2082 An error has occurred. Please contact your administrator. The complete error has been logged by CAF with SecureErrorID:2008-12-17-14:18:08.890-#105
                </messageString>
</ns1:message>


这两个错误还不确定是否可以作为空报表判断的依据。

你可能感兴趣的:(apache)