cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benson Margulies" <bimargul...@gmail.com>
Subject Re: Aegis databinding independently of CXF
Date Sat, 06 Dec 2008 23:21:58 GMT
Magnus, have you looked at the unit tests that test standalone Aegis?

On Sat, Dec 6, 2008 at 5:15 PM, Magnus Kvalheim <magnus@kvalheim.dk> wrote:
> Hi all,
>
> I'm interested in trying Aegis over JAXB as a xml<->java mapping solution.
>
> The user guide, http://cwiki.apache.org/CXF20DOC/aegis-21.html, indicates
> this is possible, but I haven't been able to find any examples of such.
>
> I've tried with a simple example:
>
> public class MappingTest implements Serializable{
>
>    private static final long serialVersionUID = 1L;
>    private String text1;
>    private Integer number1;
>    private Boolean bool1;
>    private int[] intArr1;
>    public MappingTest() {
>        text1 = "A testing string";
>        number1 = 42;
>        bool1 = true;
>        intArr1 = new int[]{2,5,7,9,23,54};
>    }
>    public String getText1() {return text1;    }
>    public Integer getNumber1() {return number1;}
>    public Boolean getBool1() {return bool1;}
>    public int[] getIntArr1() {return intArr1;}
>
>    public static void main(String[] args) throws Exception {
>
>        MappingTest test = new MappingTest();
>        AegisContext ctx = new AegisContext();
>        XMLOutputFactory factory = XMLOutputFactory.newInstance();
>        OutputStream out = new FileOutputStream("data.xml");
>
>        XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out);
>        AegisWriter<XMLStreamWriter> aegisWriter =
> ctx.createXMLStreamWriter();
>        aegisWriter.write(test, new QName("test"), true, xmlWriter,
> null);
>    }
> }
> But get a nullpointerexception here:
> Exception in thread "main" java.lang.NullPointerException
>    at
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:80)
>    at
> org.apache.cxf.aegis.AegisXMLStreamDataWriter.write(AegisXMLStreamDataWriter.java:33)
>    at MappingTest.main(MappingTest.java:38)
>
>
> What is required in order to serialize a bean with simple types?
>
> Can anyone on the list tell me if I'm on the right track?
>
> Thanks,
> Magnus
>

Mime
View raw message