SWS-485 - xml:lang="en" attribute in <faultstring> element is not compliant to SOAP/1.1 schema

This commit is contained in:
Arjen Poutsma
2009-05-14 11:38:01 +00:00
parent f9e6cde177
commit cd05c54822
14 changed files with 142 additions and 50 deletions

View File

@@ -45,8 +45,14 @@ import org.springframework.xml.namespace.QNameUtils;
*/
class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
AxiomSoap11Body(SOAPBody axiomBody, SOAPFactory axiomFactory, boolean payloadCaching) {
private final boolean langAttributeOnSoap11FaulString;
AxiomSoap11Body(SOAPBody axiomBody,
SOAPFactory axiomFactory,
boolean payloadCaching,
boolean langAttributeOnSoap11FaulString) {
super(axiomBody, axiomFactory, payloadCaching);
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
public SoapFault addMustUnderstandFault(String faultString, Locale locale) {
@@ -69,21 +75,24 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
public Soap11Fault addFault(QName code, String faultString, Locale locale) {
public Soap11Fault addFault(QName code, String faultString, Locale faultStringLocale) {
Assert.notNull(code, "No faultCode given");
Assert.hasLength(faultString, "faultString cannot be empty");
if (!StringUtils.hasLength(code.getNamespaceURI())) {
throw new IllegalArgumentException(
"A fault code with namespace and local part must be specific for a custom fault code");
}
if (!langAttributeOnSoap11FaulString) {
faultStringLocale = null;
}
try {
AxiomUtils.removeContents(getAxiomBody());
SOAPFault fault = getAxiomFactory().createSOAPFault(getAxiomBody());
SOAPFaultCode faultCode = getAxiomFactory().createSOAPFaultCode(fault);
setValueText(code, fault, faultCode);
SOAPFaultReason faultReason = getAxiomFactory().createSOAPFaultReason(fault);
if (locale != null) {
addLangAttribute(locale, faultReason);
if (faultStringLocale != null) {
addLangAttribute(faultStringLocale, faultReason);
}
faultReason.setText(faultString);
return new AxiomSoap11Fault(fault, getAxiomFactory());
@@ -92,7 +101,6 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
catch (SOAPProcessingException ex) {
throw new AxiomSoapFaultException(ex);
}
}
private void setValueText(QName code, SOAPFault fault, SOAPFaultCode faultCode) {

View File

@@ -24,9 +24,15 @@ class AxiomSoapEnvelope extends AxiomSoapElement implements SoapEnvelope {
private AxiomSoapBody body;
AxiomSoapEnvelope(SOAPEnvelope axiomEnvelope, SOAPFactory axiomFactory, boolean payloadCaching) {
private final boolean langAttributeOnSoap11FaulString;
AxiomSoapEnvelope(SOAPEnvelope axiomEnvelope,
SOAPFactory axiomFactory,
boolean payloadCaching,
boolean langAttributeOnSoap11FaulString) {
super(axiomEnvelope, axiomFactory);
this.payloadCaching = payloadCaching;
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
public SoapHeader getHeader() {
@@ -59,7 +65,8 @@ class AxiomSoapEnvelope extends AxiomSoapElement implements SoapEnvelope {
SOAPBody axiomBody = getAxiomEnvelope().getBody();
String namespaceURI = getAxiomEnvelope().getNamespace().getNamespaceURI();
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) {
body = new AxiomSoap11Body(axiomBody, getAxiomFactory(), payloadCaching);
body = new AxiomSoap11Body(axiomBody, getAxiomFactory(), payloadCaching,
langAttributeOnSoap11FaulString);
}
else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceURI)) {
body = new AxiomSoap12Body(axiomBody, getAxiomFactory(), payloadCaching);

View File

@@ -71,13 +71,15 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
private String soapAction;
private final boolean langAttributeOnSoap11FaulString;
/**
* Create a new, empty <code>AxiomSoapMessage</code>.
*
* @param soapFactory the AXIOM SOAPFactory
*/
public AxiomSoapMessage(SOAPFactory soapFactory) {
this(soapFactory, true);
this(soapFactory, true, true);
}
/**
@@ -85,12 +87,13 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
*
* @param soapFactory the AXIOM SOAPFactory
*/
public AxiomSoapMessage(SOAPFactory soapFactory, boolean payloadCaching) {
public AxiomSoapMessage(SOAPFactory soapFactory, boolean payloadCaching, boolean langAttributeOnSoap11FaulString) {
SOAPEnvelope soapEnvelope = soapFactory.getDefaultEnvelope();
axiomFactory = soapFactory;
axiomMessage = axiomFactory.createSOAPMessage(soapEnvelope, soapEnvelope.getBuilder());
attachments = new Attachments();
this.payloadCaching = payloadCaching;
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
soapAction = EMPTY_SOAP_ACTION;
}
@@ -101,8 +104,11 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
* @param soapAction the value of the SOAP Action header
* @param payloadCaching whether the contents of the SOAP body should be cached or not
*/
public AxiomSoapMessage(SOAPMessage soapMessage, String soapAction, boolean payloadCaching) {
this(soapMessage, new Attachments(), soapAction, payloadCaching);
public AxiomSoapMessage(SOAPMessage soapMessage,
String soapAction,
boolean payloadCaching,
boolean langAttributeOnSoap11FaulString) {
this(soapMessage, new Attachments(), soapAction, payloadCaching, langAttributeOnSoap11FaulString);
}
/**
@@ -116,7 +122,8 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
public AxiomSoapMessage(SOAPMessage soapMessage,
Attachments attachments,
String soapAction,
boolean payloadCaching) {
boolean payloadCaching,
boolean langAttributeOnSoap11FaulString) {
Assert.notNull(soapMessage, "'soapMessage' must not be null");
Assert.notNull(attachments, "'attachments' must not be null");
axiomMessage = soapMessage;
@@ -127,6 +134,7 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
}
this.soapAction = soapAction;
this.payloadCaching = payloadCaching;
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
/** Return the AXIOM <code>SOAPMessage</code> that this <code>AxiomSoapMessage</code> is based on. */
@@ -149,7 +157,8 @@ public class AxiomSoapMessage extends AbstractSoapMessage {
public SoapEnvelope getEnvelope() {
if (envelope == null) {
try {
envelope = new AxiomSoapEnvelope(axiomMessage.getSOAPEnvelope(), axiomFactory, payloadCaching);
envelope = new AxiomSoapEnvelope(axiomMessage.getSOAPEnvelope(), axiomFactory, payloadCaching,
langAttributeOnSoap11FaulString);
}
catch (SOAPProcessingException ex) {
throw new AxiomSoapEnvelopeException(ex);

View File

@@ -101,6 +101,8 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
// use SOAP 1.1 by default
private SOAPFactory soapFactory = new SOAP11Factory();
private boolean langAttributeOnSoap11FaulString = true;
/** Default constructor. */
public AxiomSoapMessageFactory() {
inputFactory = XMLInputFactory.newInstance();
@@ -165,6 +167,18 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
}
}
/**
* Defines whether a {@code xml:lang} attribute should be set on SOAP 1.1 {@code <faultstring>} elements.
* <p/>
* The default is {@code true}, to comply with WS-I, but this flag can be set to {@code false} to the older W3C SOAP
* 1.1 specification.
*
* @see <a href="http://www.ws-i.org/Profiles/BasicProfile-1.1.html#SOAP_Fault_Language">WS-I Basic Profile 1.1</a>
*/
public void setLangAttributeOnSoap11FaulString(boolean langAttributeOnSoap11FaulString) {
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
public void afterPropertiesSet() throws Exception {
if (logger.isInfoEnabled()) {
logger.info(payloadCaching ? "Enabled payload caching" : "Disabled payload caching");
@@ -176,7 +190,7 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
}
public WebServiceMessage createWebServiceMessage() {
return new AxiomSoapMessage(soapFactory, payloadCaching);
return new AxiomSoapMessage(soapFactory, payloadCaching, langAttributeOnSoap11FaulString);
}
public WebServiceMessage createWebServiceMessage(InputStream inputStream) throws IOException {
@@ -227,15 +241,16 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
String envelopeNamespace = getSoapEnvelopeNamespace(contentType);
StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapFactory, envelopeNamespace);
SOAPMessage soapMessage = builder.getSoapMessage();
return new AxiomSoapMessage(soapMessage, soapAction, payloadCaching);
return new AxiomSoapMessage(soapMessage, soapAction, payloadCaching, langAttributeOnSoap11FaulString);
}
/** Creates an AxiomSoapMessage with attachments. */
private AxiomSoapMessage createMultiPartAxiomSoapMessage(InputStream inputStream,
String contentType,
String soapAction) throws XMLStreamException {
Attachments attachments = new Attachments(inputStream, contentType, attachmentCaching,
attachmentCacheDir.getAbsolutePath(), Integer.toString(attachmentCacheThreshold));
Attachments attachments =
new Attachments(inputStream, contentType, attachmentCaching, attachmentCacheDir.getAbsolutePath(),
Integer.toString(attachmentCacheThreshold));
XMLStreamReader reader = inputFactory.createXMLStreamReader(attachments.getSOAPPartInputStream(),
getCharSetEncoding(attachments.getSOAPPartContentType()));
StAXSOAPModelBuilder builder;
@@ -251,7 +266,8 @@ public class AxiomSoapMessageFactory implements SoapMessageFactory, Initializing
throw new AxiomSoapMessageCreationException(
"Unknown attachment type: [" + attachments.getAttachmentSpecType() + "]");
}
return new AxiomSoapMessage(builder.getSoapMessage(), attachments, soapAction, payloadCaching);
return new AxiomSoapMessage(builder.getSoapMessage(), attachments, soapAction, payloadCaching,
langAttributeOnSoap11FaulString);
}
private String getSoapEnvelopeNamespace(String contentType) {

View File

@@ -36,8 +36,11 @@ import org.springframework.ws.soap.soap11.Soap11Fault;
*/
class SaajSoap11Body extends SaajSoapBody implements Soap11Body {
SaajSoap11Body(SOAPBody body) {
private final boolean langAttributeOnSoap11FaulString;
SaajSoap11Body(SOAPBody body, boolean langAttributeOnSoap11FaulString) {
super(body);
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
public SoapFault getFault() {
@@ -50,6 +53,9 @@ class SaajSoap11Body extends SaajSoapBody implements Soap11Body {
Assert.hasLength(faultString, "faultString cannot be empty");
Assert.hasLength(faultCode.getLocalPart(), "faultCode's localPart cannot be empty");
Assert.hasLength(faultCode.getNamespaceURI(), "faultCode's namespaceUri cannot be empty");
if (!langAttributeOnSoap11FaulString) {
faultStringLocale = null;
}
try {
getImplementation().removeContents(getSaajBody());
SOAPFault saajFault =

View File

@@ -17,6 +17,7 @@
package org.springframework.ws.soap.saaj;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
@@ -39,8 +40,11 @@ class SaajSoapEnvelope extends SaajSoapElement implements SoapEnvelope {
private SaajSoapHeader header;
public SaajSoapEnvelope(SOAPEnvelope envelope) {
super(envelope);
private final boolean langAttributeOnSoap11FaulString;
SaajSoapEnvelope(SOAPElement element, boolean langAttributeOnSoap11FaulString) {
super(element);
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
public SoapBody getBody() {
@@ -49,7 +53,7 @@ class SaajSoapEnvelope extends SaajSoapElement implements SoapEnvelope {
SOAPBody saajBody = getImplementation().getBody(getSaajEnvelope());
if (getImplementation().getName(saajBody).getNamespaceURI()
.equals(SoapVersion.SOAP_11.getEnvelopeNamespaceUri())) {
body = new SaajSoap11Body(saajBody);
body = new SaajSoap11Body(saajBody, langAttributeOnSoap11FaulString);
}
else {
body = new SaajSoap12Body(saajBody);

View File

@@ -51,11 +51,13 @@ import org.springframework.ws.transport.TransportConstants;
*/
public class SaajSoapMessage extends AbstractSoapMessage {
private static final String CONTENT_TYPE_XOP = "application/xop+xml";
private SOAPMessage saajMessage;
private SoapEnvelope envelope;
private static final String CONTENT_TYPE_XOP = "application/xop+xml";
private final boolean langAttributeOnSoap11FaulString;
/**
* Create a new <code>SaajSoapMessage</code> based on the given SAAJ <code>SOAPMessage</code>.
@@ -63,12 +65,24 @@ public class SaajSoapMessage extends AbstractSoapMessage {
* @param soapMessage the SAAJ SOAPMessage
*/
public SaajSoapMessage(SOAPMessage soapMessage) {
this(soapMessage, true);
}
/**
* Create a new <code>SaajSoapMessage</code> based on the given SAAJ <code>SOAPMessage</code>.
*
* @param soapMessage the SAAJ SOAPMessage
* @param langAttributeOnSoap11FaulString
* whether a {@code xml:lang} attribute is allowed on SOAP 1.1 {@code <faultstring>} elements
*/
public SaajSoapMessage(SOAPMessage soapMessage, boolean langAttributeOnSoap11FaulString) {
Assert.notNull(soapMessage, "soapMessage must not be null");
MimeHeaders headers = getImplementation().getMimeHeaders(soapMessage);
if (ObjectUtils.isEmpty(headers.getHeader(TransportConstants.HEADER_SOAP_ACTION))) {
headers.addHeader(TransportConstants.HEADER_SOAP_ACTION, "\"\"");
}
saajMessage = soapMessage;
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
/** Return the SAAJ <code>SOAPMessage</code> that this <code>SaajSoapMessage</code> is based on. */
@@ -87,7 +101,7 @@ public class SaajSoapMessage extends AbstractSoapMessage {
if (envelope == null) {
try {
SOAPEnvelope saajEnvelope = getImplementation().getEnvelope(getSaajMessage());
envelope = new SaajSoapEnvelope(saajEnvelope);
envelope = new SaajSoapEnvelope(saajEnvelope, langAttributeOnSoap11FaulString);
}
catch (SOAPException ex) {
throw new SaajSoapEnvelopeException(ex);

View File

@@ -61,6 +61,8 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
private String messageFactoryProtocol;
private boolean langAttributeOnSoap11FaulString = true;
/** Default, empty constructor. */
public SaajSoapMessageFactory() {
}
@@ -80,6 +82,18 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
this.messageFactory = messageFactory;
}
/**
* Defines whether a {@code xml:lang} attribute should be set on SOAP 1.1 {@code <faultstring>} elements.
* <p/>
* The default is {@code true}, to comply with WS-I, but this flag can be set to {@code false} to the older W3C SOAP
* 1.1 specification.
*
* @see <a href="http://www.ws-i.org/Profiles/BasicProfile-1.1.html#SOAP_Fault_Language">WS-I Basic Profile 1.1</a>
*/
public void setLangAttributeOnSoap11FaulString(boolean langAttributeOnSoap11FaulString) {
this.langAttributeOnSoap11FaulString = langAttributeOnSoap11FaulString;
}
public void setSoapVersion(SoapVersion version) {
if (SaajUtils.getSaajVersion() >= SaajUtils.SAAJ_13) {
if (SoapVersion.SOAP_11 == version) {
@@ -140,7 +154,7 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
public WebServiceMessage createWebServiceMessage() {
try {
return new SaajSoapMessage(messageFactory.createMessage());
return new SaajSoapMessage(messageFactory.createMessage(), langAttributeOnSoap11FaulString);
}
catch (SOAPException ex) {
throw new SoapMessageCreationException("Could not create empty message: " + ex.getMessage(), ex);
@@ -162,7 +176,8 @@ public class SaajSoapMessageFactory implements SoapMessageFactory, InitializingB
contentType = contentType.replace("startinfo", "start-info");
mimeHeaders.setHeader(TransportConstants.HEADER_CONTENT_TYPE, contentType);
try {
return new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, inputStream));
return new SaajSoapMessage(messageFactory.createMessage(mimeHeaders, inputStream),
langAttributeOnSoap11FaulString);
}
catch (SOAPException e) {
// fall-through

View File

@@ -44,4 +44,5 @@ public class AxiomSoap11BodyTest extends AbstractSoap11BodyTestCase {
transformer.transform(new StringSource(payload), soapBody.getPayloadResult());
assertPayloadEqual(payload);
}
}

View File

@@ -23,6 +23,7 @@ import javax.xml.stream.XMLStreamReader;
import junit.framework.TestCase;
import org.apache.axiom.soap.SOAPMessage;
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.SoapFaultDetail;
@@ -57,13 +58,13 @@ public class AxiomSoapFaultDetailTest extends TestCase {
StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser);
SOAPMessage soapMessage = builder.getSoapMessage();
failingMessage = new AxiomSoapMessage(soapMessage, null, false);
failingMessage = new AxiomSoapMessage(soapMessage, null, false, true);
parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(SUCCEEDING_FAULT));
builder = new StAXSOAPModelBuilder(parser);
soapMessage = builder.getSoapMessage();
succeedingMessage = new AxiomSoapMessage(soapMessage, null, false);
succeedingMessage = new AxiomSoapMessage(soapMessage, null, false, true);
}

View File

@@ -16,7 +16,9 @@
package org.springframework.ws.soap.saaj;
import java.util.Locale;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
import javax.xml.soap.SOAPMessage;
@@ -28,7 +30,25 @@ public class SaajSoap11BodyTest extends AbstractSoap11BodyTestCase {
protected SoapBody createSoapBody() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new SaajSoap11Body(saajMessage.getSOAPPart().getEnvelope().getBody());
return new SaajSoap11Body(saajMessage.getSOAPPart().getEnvelope().getBody(), true);
}
public void testLangAttributeOnSoap11FaulString() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
SOAPBody saajSoapBody = saajMessage.getSOAPPart().getEnvelope().getBody();
SaajSoap11Body soapBody = new SaajSoap11Body(saajSoapBody, true);
soapBody.addClientOrSenderFault("Foo", Locale.ENGLISH);
assertNotNull("No Language set", saajSoapBody.getFault().getFaultStringLocale());
saajSoapBody = saajMessage.getSOAPPart().getEnvelope().getBody();
soapBody = new SaajSoap11Body(saajSoapBody, false);
soapBody.addClientOrSenderFault("Foo", Locale.ENGLISH);
assertNull("Language set", saajSoapBody.getFault().getFaultStringLocale());
}
}

View File

@@ -28,6 +28,6 @@ public class SaajSoap11EnvelopeTest extends AbstractSoap11EnvelopeTestCase {
protected SoapEnvelope createSoapEnvelope() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope(), true);
}
}

View File

@@ -28,6 +28,6 @@ public class SaajSoap12EnvelopeTest extends AbstractSoap12EnvelopeTestCase {
protected SoapEnvelope createSoapEnvelope() throws Exception {
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
SOAPMessage saajMessage = messageFactory.createMessage();
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope());
return new SaajSoapEnvelope(saajMessage.getSOAPPart().getEnvelope(), true);
}
}

View File

@@ -48,11 +48,9 @@ public abstract class Wss4jTestCase extends TestCase {
protected MessageFactory messageFactory;
protected final boolean axiomTest = this.getClass().getSimpleName()
.startsWith("Axiom");
protected final boolean axiomTest = this.getClass().getSimpleName().startsWith("Axiom");
protected final boolean saajTest = this.getClass().getSimpleName()
.startsWith("Saaj");
protected final boolean saajTest = this.getClass().getSimpleName().startsWith("Saaj");
protected Map namespaces;
@@ -77,22 +75,19 @@ public abstract class Wss4jTestCase extends TestCase {
String expectedValue,
String xpathExpression,
Document document) {
XPathExpression expression = XPathExpressionFactory
.createXPathExpression(xpathExpression, namespaces);
XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression, namespaces);
String actualValue = expression.evaluateAsString(document);
assertEquals(message, expectedValue, actualValue);
}
protected void assertXpathExists(String message, String xpathExpression, Document document) {
XPathExpression expression = XPathExpressionFactory
.createXPathExpression(xpathExpression, namespaces);
XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression, namespaces);
Node node = expression.evaluateAsNode(document);
assertNotNull(message, node);
}
protected void assertXpathNotExists(String message, String xpathExpression, Document document) {
XPathExpression expression = XPathExpressionFactory
.createXPathExpression(xpathExpression, namespaces);
XPathExpression expression = XPathExpressionFactory.createXPathExpression(xpathExpression, namespaces);
Node node = expression.evaluateAsNode(document);
assertNull(message, node);
}
@@ -119,12 +114,10 @@ public abstract class Wss4jTestCase extends TestCase {
assertTrue("Could not load Axiom message [" + resource + "]", resource.exists());
is = resource.getInputStream();
XMLStreamReader parser = XMLInputFactory.newInstance()
.createXMLStreamReader(is);
XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(is);
StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(parser, null);
org.apache.axiom.soap.SOAPMessage soapMessage = builder
.getSoapMessage();
return new AxiomSoapMessage(soapMessage, "", true);
org.apache.axiom.soap.SOAPMessage soapMessage = builder.getSoapMessage();
return new AxiomSoapMessage(soapMessage, "", true, true);
}
finally {
is.close();
@@ -144,13 +137,11 @@ public abstract class Wss4jTestCase extends TestCase {
protected void setMessage(SoapMessage soapMessage, Object message) {
if (soapMessage instanceof SaajSoapMessage) {
((SaajSoapMessage) soapMessage)
.setSaajMessage((SOAPMessage) message);
((SaajSoapMessage) soapMessage).setSaajMessage((SOAPMessage) message);
return;
}
if (soapMessage instanceof AxiomSoapMessage) {
((AxiomSoapMessage) soapMessage)
.setAxiomMessage((org.apache.axiom.soap.SOAPMessage) message);
((AxiomSoapMessage) soapMessage).setAxiomMessage((org.apache.axiom.soap.SOAPMessage) message);
return;
}
throw new IllegalArgumentException("Illegal message: " + message);