You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Michael Hänni <ha...@gmail.com> on 2008/07/01 18:17:33 UTC

[AXIS2] JAXB Marshaller

Hello

I'm using JAXB in one of my handlers. For marschalling I do:

    public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault
{

        SOAPEnvelope env = msgCtx.getEnvelope();

        try {
            // initialize jaxb context and unmarshaller
            JAXBContext context = JAXBContext.newInstance(JAXB_CONTEXT);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            unmarshaller
                    .setEventHandler(new
javax.xml.bind.helpers.DefaultValidationEventHandler());

            // unmarshal the MessageContext
            Object message = unmarshaller.unmarshal(env.getBody()
                    .getFirstElement().getXMLStreamReader());
  ...

This woks perfect, but how can I marshall the Object "message" back to the
MessageContext, to apply the changes I made?

Thanks,
Michael