首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

AXIS2数据解析跟封装

2013-07-11 
AXIS2数据解析和封装一、解析示例:1、/*** 测试* @param statistic* @param userId* @return*/public static

AXIS2数据解析和封装

一、解析示例:

1、    /**     * 测试     * @param statistic     * @param userId     * @return     */    public static String sendDataDfzwByOMElement() {        targetEPR = new EndpointReference("http://192.168.10.227/ebsService/services/ebsService?wsdl");        // 创建request SOAP包        OMFactory fac = OMAbstractFactory.getOMFactory();        // OMNamespace指定此SOAP文档名称空间        OMNamespace om = fac.createOMNamespace("http://service.eee.shun.com", "client");        // 创建元素,并指定其在om指代的名称空间中,元素名必须跟services.xml重大operation的name相同        OMElement method = fac.createOMElement("senddividendstrategy", om);        OMElement root;        OMElement svsListOmElement;        List<Senddividendstrategy> svsList = new ArrayList<Senddividendstrategy>();        try {            Senddividendstrategy s = new Senddividendstrategy();            for (int i = 0; i < 10 ; i++) {                s.setDividend_date("1");                s.setCompany_code("2");                s.setEquity_note_number("3");                s.setDividend_line_number(Long.valueOf(4));                s.setAssign_type_code("5");                s.setAssign_source("6");                s.setSegment3("7");                               s.setAmount(Long.valueOf(8));                s.setCash_amount(Long.valueOf(9));                s.setCash_proportion(Long.valueOf(10));                s.setCash_person_proportion(Long.valueOf(11));                s.setCapital_source("12");                s.setCapital_amount(Long.valueOf(13));                s.setCapital_proportion(Long.valueOf(14));                               s.setCapital_person_proportion(Long.valueOf(15));                s.setEquity_category("16");                s.setEquity_properties("17");                s.setReduce_tax_amount(Long.valueOf(18));                s.setStart_date("19");                               s.setManager_type("20");                s.setProcess_startus("21");                s.setData_status("22");                s.setX_msg_data("23");                s.setX_return_status("24");                               svsList.add(s);            }            root = fac.createOMElement("root", null);            svsListOmElement = BeanUtil.getOMElement(new QName("sparams"), svsList.toArray(), new QName("sparam"), false, null);            root.addChild(svsListOmElement);            method.addChild(root);                       Options options = new Options();            options.setTo(targetEPR);            ServiceClient sender = new ServiceClient();            sender.setOptions(options);            // 发出request SOAP            // 同时将得到的远端由senddividendstrategy方法返回的信息保存到result            // 通过services.xml能准确找到senddividendstrategy方法所在的文件            sender.sendReceive(method);            String filePath = "E:\\ebs.xml";            writeToFile(filePath, method);        } catch (Exception e) {            e.printStackTrace();        }        return null;    }2、    //创建response SOAP包            OMFactory fac = OMAbstractFactory.getOMFactory();            //OMNamespace指定此SOAP文档名称空间            OMNamespace omNs = fac.createOMNamespace("http://service.eee.shun.com", "service");            //创建元素SafetyTrouble返回给客服端的元素,并指定其在omNs指代的名称空间中            OMElement resp = fac.createOMElement("line-service", omNs);            OMElement root = fac.createOMElement("root", null);                       ReturnOutParameter rop = new ReturnOutParameter();            List<ReturnOutParameter> ropList = new ArrayList<ReturnOutParameter>();            OMElement ropListOmElement;                       rop.setX_return_status(x_return_status);            rop.setX_msg_data(x_msg_data);            ropList.add(rop);                       //添加消息信息            ropListOmElement = BeanUtil.getOMElement(new QName("rparams"), ropList.toArray(), new QName("rparam"), false, null);            root.addChild(ropListOmElement);            resp.addChild(root);                       return resp;

?

热点排行