SWS-483: Wss4j 1.5.5 stripping custom SOAP headers after 1.5.6 upgrade

This commit is contained in:
Arjen Poutsma
2009-05-20 11:19:19 +00:00
parent fd996a78d5
commit ec15995693
4 changed files with 103 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,8 @@ package org.springframework.ws.soap.axiom.support;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.Locale;
import javax.xml.namespace.QName;
@@ -164,7 +166,12 @@ public abstract class AxiomUtils {
StAXSOAPModelBuilder stAXSOAPModelBuilder =
new StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(bis), null);
return stAXSOAPModelBuilder.getSOAPEnvelope();
SOAPEnvelope envelope = stAXSOAPModelBuilder.getSOAPEnvelope();
// Necessary to build a correct Axiom tree, see SWS-483
envelope.serialize(new NullOutputStream());
return envelope;
}
catch (Exception ex) {
IllegalArgumentException iaex =
@@ -174,4 +181,17 @@ public abstract class AxiomUtils {
}
}
/** OutputStream that does nothing. */
private static class NullOutputStream extends OutputStream {
public void write(int b) throws IOException {
}
public void write(byte[] b) throws IOException {
}
public void write(byte[] b, int off, int len) throws IOException {
}
}
}