src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/JAXBHeader.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -26,10 +26,11 @@
package com.sun.xml.internal.ws.message.jaxb;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.XMLStreamException2;
import com.sun.xml.internal.bind.api.Bridge;
+import com.sun.xml.internal.stream.buffer.MutableXMLStreamBuffer;
import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
import com.sun.xml.internal.stream.buffer.XMLStreamBufferResult;
import com.sun.xml.internal.ws.api.message.Header;
import com.sun.xml.internal.ws.encoding.SOAPBindingCodec;
import com.sun.xml.internal.ws.message.AbstractHeaderImpl;
@@ -140,20 +141,16 @@
parse();
return atts.getValue(nsUri,localName);
}
public XMLStreamReader readHeader() throws XMLStreamException {
- try {
if(infoset==null) {
- XMLStreamBufferResult sbr = new XMLStreamBufferResult();
- bridge.marshal(jaxbObject,sbr);
- infoset = sbr.getXMLStreamBuffer();
+ MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
+ writeTo(buffer.createFromXMLStreamWriter());
+ infoset = buffer;
}
return infoset.readAsXMLStreamReader();
- } catch (JAXBException e) {
- throw new XMLStreamException2(e);
- }
}
public <T> T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
try {
JAXBResult r = new JAXBResult(unmarshaller);