读书人

异步回到WebService时在本地输出XML

发布时间: 2012-10-28 09:54:44 作者: rapoo

异步返回WebService时在本地输出XML,用以备份

private static void writeToSoapBodyFile(String fileName, CIAsset ciAsset)throws JAXBException, IOException {File dir = new File(soapBody);if (!dir.exists()) {dir.mkdirs();}JAXBContext ctx = JAXBContext.newInstance(CIAsset.class);Marshaller m = ctx.createMarshaller();m.setProperty("jaxb.formatted.output", true);File file = new File(soapBody + fileName);OutputStream os = new FileOutputStream(file);m.marshal(ciAsset, os);os.flush();os.close();}

读书人网 >Web前端

热点推荐