当前位置: 代码迷 >> Web前端 >> 异步回到WebService时在本地输出XML,用以备份
  详细解决方案

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

热度:98   发布时间:2012-10-28 09:54:44.0
异步返回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();
	}
  相关解决方案