00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 package org.jaebi.test.server.xml;
00012 import org.jaebi.server.service.xml.JAXBMarshallerWrapper;
00013 import org.jaebi.server.service.xml.JAXBMarshallerWrapperImpl;
00014 import org.jaebi.server.service.xml.JAXBXResponseFactory;
00015 import org.jaebi.server.service.xml.exception.JAXBMarshallerWrapperInitException;
00016 import org.jaebi.server.service.xml.exception.JAXBMarshallerWrapperMarshallException;
00017 import org.jaebi.server.service.xml.exception.JAXBMarshallerWrapperUnmarshallException;
00018 import org.jaebi.server.service.xml.exception.JAXBXResponseFactoryBuildingException;
00019 import org.jaebi.server.service.xml.xresponse.Xresponse;
00024 public class MainTestJAXBXresponse {
00025
00029 public static void main(String[] args) {
00030 JAXBMarshallerWrapper marshWrap = null;
00031 JAXBXResponseFactory xrespFactory = new JAXBXResponseFactory();
00032 Xresponse responseXML = null;
00033 String responseXMLStr = null;
00034
00035 try {
00036 responseXML = (Xresponse)xrespFactory.buildXresponse(true, "query ok");
00037 marshWrap = new JAXBMarshallerWrapperImpl("org.jaebi.server.service.xml.xresponse");
00038 } catch ( JAXBMarshallerWrapperInitException e ) {
00039 e.printStackTrace();
00040 } catch ( JAXBXResponseFactoryBuildingException e ) {
00041 e.printStackTrace();
00042 }
00043
00044 try {
00045 marshWrap.setFormattedMarshalling(true);
00046 responseXMLStr = marshWrap.marshall(responseXML);
00047 } catch ( JAXBMarshallerWrapperMarshallException e ) {
00048 e.printStackTrace();
00049 } finally {
00050 System.out.println("XML Marshalled:\n" + responseXMLStr);
00051 }
00052
00053 try {
00054 responseXML = (Xresponse)marshWrap.unmarshall(responseXMLStr);
00055 } catch ( JAXBMarshallerWrapperUnmarshallException e ) {
00056 e.printStackTrace();
00057 }
00058
00059
00060 }
00061
00062 }