Upgraded to Axiom 1.2.3
This commit is contained in:
@@ -19,6 +19,7 @@ package org.springframework.ws.soap.axiom;
|
||||
import java.util.Locale;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.axiom.om.OMAttribute;
|
||||
import org.apache.axiom.om.OMNamespace;
|
||||
import org.apache.axiom.soap.SOAP11Constants;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
@@ -26,8 +27,6 @@ import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFault;
|
||||
import org.apache.axiom.soap.SOAPFaultCode;
|
||||
import org.apache.axiom.soap.SOAPFaultReason;
|
||||
import org.apache.axiom.soap.SOAPFaultText;
|
||||
import org.apache.axiom.soap.SOAPFaultValue;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -79,14 +78,12 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
|
||||
detachAllBodyChildren();
|
||||
SOAPFault fault = axiomFactory.createSOAPFault(axiomBody);
|
||||
SOAPFaultCode faultCode = axiomFactory.createSOAPFaultCode(fault);
|
||||
SOAPFaultValue faultCodeValue = axiomFactory.createSOAPFaultValue(faultCode);
|
||||
setValueText(code, fault, faultCodeValue);
|
||||
setValueText(code, fault, faultCode);
|
||||
SOAPFaultReason faultReason = axiomFactory.createSOAPFaultReason(fault);
|
||||
SOAPFaultText faultText = axiomFactory.createSOAPFaultText(faultReason);
|
||||
if (locale != null) {
|
||||
faultText.setLang(AxiomUtils.toLanguage(locale));
|
||||
addLangAttribute(locale, faultReason);
|
||||
}
|
||||
faultText.setText(faultString);
|
||||
faultReason.setText(faultString);
|
||||
return new AxiomSoap11Fault(fault, axiomFactory);
|
||||
|
||||
}
|
||||
@@ -96,7 +93,7 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
|
||||
|
||||
}
|
||||
|
||||
private void setValueText(QName code, SOAPFault fault, SOAPFaultValue faultValue) {
|
||||
private void setValueText(QName code, SOAPFault fault, SOAPFaultCode faultCode) {
|
||||
String prefix = QNameUtils.getPrefix(code);
|
||||
if (StringUtils.hasLength(code.getNamespaceURI()) && StringUtils.hasLength(prefix)) {
|
||||
OMNamespace namespace = fault.findNamespaceURI(prefix);
|
||||
@@ -111,7 +108,34 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
|
||||
}
|
||||
code = QNameUtils.createQName(code.getNamespaceURI(), code.getLocalPart(), namespace.getPrefix());
|
||||
}
|
||||
faultValue.setText(prefix + ":" + code.getLocalPart());
|
||||
faultCode.setText(code);
|
||||
}
|
||||
|
||||
private SOAPFault addStandardFault(String localName, String faultString, Locale locale) {
|
||||
Assert.notNull(faultString, "No faultString given");
|
||||
try {
|
||||
detachAllBodyChildren();
|
||||
SOAPFault fault = axiomFactory.createSOAPFault(axiomBody);
|
||||
SOAPFaultCode faultCode = axiomFactory.createSOAPFaultCode(fault);
|
||||
faultCode.setText(
|
||||
new QName(fault.getNamespace().getNamespaceURI(), localName, fault.getNamespace().getPrefix()));
|
||||
SOAPFaultReason faultReason = axiomFactory.createSOAPFaultReason(fault);
|
||||
if (locale != null) {
|
||||
addLangAttribute(locale, faultReason);
|
||||
}
|
||||
faultReason.setText(faultString);
|
||||
return fault;
|
||||
}
|
||||
catch (SOAPProcessingException ex) {
|
||||
throw new AxiomSoapFaultException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void addLangAttribute(Locale locale, SOAPFaultReason faultReason) {
|
||||
OMNamespace xmlNamespace = axiomFactory.createOMNamespace("http://www.w3.org/XML/1998/namespace", "xml");
|
||||
OMAttribute langAttribute = axiomFactory.createOMAttribute("lang", xmlNamespace, AxiomUtils.toLanguage(locale));
|
||||
faultReason.addAttribute(langAttribute);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
package org.springframework.ws.soap.axiom;
|
||||
|
||||
import java.util.Locale;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
import org.apache.axiom.om.OMAttribute;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFault;
|
||||
import org.apache.axiom.soap.SOAPFaultText;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.ws.soap.soap11.Soap11Fault;
|
||||
|
||||
@@ -35,21 +36,23 @@ class AxiomSoap11Fault extends AxiomSoapFault implements Soap11Fault {
|
||||
super(axiomFault, axiomFactory);
|
||||
}
|
||||
|
||||
public QName getFaultCode() {
|
||||
return axiomFault.getCode().getTextAsQName();
|
||||
}
|
||||
|
||||
public String getFaultStringOrReason() {
|
||||
if (axiomFault.getReason() != null) {
|
||||
SOAPFaultText soapText = axiomFault.getReason().getFirstSOAPText();
|
||||
if (soapText != null) {
|
||||
return soapText.getText();
|
||||
}
|
||||
return axiomFault.getReason().getText();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Locale getFaultStringLocale() {
|
||||
if (axiomFault.getReason() != null) {
|
||||
SOAPFaultText soapText = axiomFault.getReason().getFirstSOAPText();
|
||||
if (soapText != null) {
|
||||
String xmlLangString = soapText.getLang();
|
||||
OMAttribute langAttribute =
|
||||
axiomFault.getReason().getAttribute(new QName("http://www.w3.org/XML/1998/namespace", "lang"));
|
||||
if (langAttribute != null) {
|
||||
String xmlLangString = langAttribute.getAttributeValue();
|
||||
if (xmlLangString != null) {
|
||||
return AxiomUtils.toLocale(xmlLangString);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,14 @@ import org.apache.axiom.soap.SOAP12Constants;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFault;
|
||||
import org.apache.axiom.soap.SOAPFaultCode;
|
||||
import org.apache.axiom.soap.SOAPFaultReason;
|
||||
import org.apache.axiom.soap.SOAPFaultText;
|
||||
import org.apache.axiom.soap.SOAPFaultValue;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.soap.SoapFault;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.ws.soap.soap12.Soap12Body;
|
||||
import org.springframework.ws.soap.soap12.Soap12Fault;
|
||||
|
||||
@@ -69,4 +75,26 @@ class AxiomSoap12Body extends AxiomSoapBody implements Soap12Body {
|
||||
return new AxiomSoap12Fault(fault, axiomFactory);
|
||||
}
|
||||
|
||||
private SOAPFault addStandardFault(String localName, String faultStringOrReason, Locale locale) {
|
||||
Assert.notNull(faultStringOrReason, "No faultStringOrReason given");
|
||||
try {
|
||||
detachAllBodyChildren();
|
||||
SOAPFault fault = axiomFactory.createSOAPFault(axiomBody);
|
||||
SOAPFaultCode code = axiomFactory.createSOAPFaultCode(fault);
|
||||
SOAPFaultValue value = axiomFactory.createSOAPFaultValue(code);
|
||||
value.setText(fault.getNamespace().getPrefix() + ":" + localName);
|
||||
SOAPFaultReason reason = axiomFactory.createSOAPFaultReason(fault);
|
||||
SOAPFaultText text = axiomFactory.createSOAPFaultText(reason);
|
||||
if (locale != null) {
|
||||
text.setLang(AxiomUtils.toLanguage(locale));
|
||||
}
|
||||
text.setText(faultStringOrReason);
|
||||
return fault;
|
||||
}
|
||||
catch (SOAPProcessingException ex) {
|
||||
throw new AxiomSoapFaultException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,20 +37,22 @@ import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.ws.soap.soap12.Soap12Fault;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
|
||||
/**
|
||||
* Axiom-specific version of <code>org.springframework.ws.soap.Soap12Fault</code>.
|
||||
*/
|
||||
/** Axiom-specific version of <code>org.springframework.ws.soap.Soap12Fault</code>. */
|
||||
class AxiomSoap12Fault extends AxiomSoapFault implements Soap12Fault {
|
||||
|
||||
AxiomSoap12Fault(SOAPFault axiomFault, SOAPFactory axiomFactory) {
|
||||
super(axiomFault, axiomFactory);
|
||||
}
|
||||
|
||||
public QName getFaultCode() {
|
||||
return axiomFault.getCode().getValue().getTextAsQName();
|
||||
}
|
||||
|
||||
public Iterator getFaultSubcodes() {
|
||||
List subcodes = new ArrayList();
|
||||
SOAPFaultSubCode subcode = axiomFault.getCode().getSubCode();
|
||||
while (subcode != null) {
|
||||
subcodes.add(getFaultCode(subcode.getValue()));
|
||||
subcodes.add(subcode.getValue().getTextAsQName());
|
||||
subcode = subcode.getSubCode();
|
||||
}
|
||||
return subcodes.iterator();
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.ws.soap.axiom;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.Source;
|
||||
@@ -28,15 +27,9 @@ import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.soap.SOAPBody;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFault;
|
||||
import org.apache.axiom.soap.SOAPFaultCode;
|
||||
import org.apache.axiom.soap.SOAPFaultReason;
|
||||
import org.apache.axiom.soap.SOAPFaultText;
|
||||
import org.apache.axiom.soap.SOAPFaultValue;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.soap.SoapBody;
|
||||
import org.springframework.ws.soap.SoapFault;
|
||||
import org.springframework.ws.soap.axiom.support.AxiomUtils;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
/**
|
||||
@@ -116,24 +109,4 @@ abstract class AxiomSoapBody implements SoapBody {
|
||||
|
||||
}
|
||||
|
||||
protected SOAPFault addStandardFault(String localName, String faultStringOrReason, Locale locale) {
|
||||
Assert.notNull(faultStringOrReason, "No faultStringOrReason given");
|
||||
try {
|
||||
detachAllBodyChildren();
|
||||
SOAPFault fault = axiomFactory.createSOAPFault(axiomBody);
|
||||
SOAPFaultCode code = axiomFactory.createSOAPFaultCode(fault);
|
||||
SOAPFaultValue value = axiomFactory.createSOAPFaultValue(code);
|
||||
value.setText(fault.getNamespace().getPrefix() + ":" + localName);
|
||||
SOAPFaultReason reason = axiomFactory.createSOAPFaultReason(fault);
|
||||
SOAPFaultText text = axiomFactory.createSOAPFaultText(reason);
|
||||
if (locale != null) {
|
||||
text.setLang(AxiomUtils.toLanguage(locale));
|
||||
}
|
||||
text.setText(faultStringOrReason);
|
||||
return fault;
|
||||
}
|
||||
catch (SOAPProcessingException ex) {
|
||||
throw new AxiomSoapFaultException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,20 +16,21 @@
|
||||
|
||||
package org.springframework.ws.soap.axiom;
|
||||
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.soap.*;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.soap.SoapFault;
|
||||
import org.springframework.ws.soap.SoapFaultDetail;
|
||||
import org.springframework.xml.namespace.QNameUtils;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
/**
|
||||
* @author Arjen Poutsma
|
||||
*/
|
||||
import org.apache.axiom.om.OMException;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.apache.axiom.soap.SOAPFault;
|
||||
import org.apache.axiom.soap.SOAPFaultDetail;
|
||||
import org.apache.axiom.soap.SOAPFaultRole;
|
||||
import org.apache.axiom.soap.SOAPProcessingException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.ws.soap.SoapFault;
|
||||
import org.springframework.ws.soap.SoapFaultDetail;
|
||||
import org.springframework.xml.transform.StaxSource;
|
||||
|
||||
/** @author Arjen Poutsma */
|
||||
abstract class AxiomSoapFault implements SoapFault {
|
||||
|
||||
protected final SOAPFault axiomFault;
|
||||
@@ -51,22 +52,6 @@ abstract class AxiomSoapFault implements SoapFault {
|
||||
return new StaxSource(axiomFault.getXMLStreamReader());
|
||||
}
|
||||
|
||||
public QName getFaultCode() {
|
||||
return getFaultCode(axiomFault.getCode().getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Axiom 1.0's getTextAsQName is broken for SOAPFaultValues, hence this.
|
||||
*/
|
||||
protected QName getFaultCode(SOAPFaultValue value) {
|
||||
String text = value.getText();
|
||||
int idx = text.indexOf(':');
|
||||
String prefix = text.substring(0, idx);
|
||||
String localPart = text.substring(idx + 1);
|
||||
String namespaceUri = axiomFault.getCode().getValue().findNamespaceURI(prefix).getNamespaceURI();
|
||||
return QNameUtils.createQName(namespaceUri, localPart, prefix);
|
||||
}
|
||||
|
||||
public String getFaultActorOrRole() {
|
||||
SOAPFaultRole faultRole = axiomFault.getRole();
|
||||
return faultRole != null ? faultRole.getRoleValue() : null;
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.ws.AbstractWebServiceMessageTestCase;
|
||||
import org.springframework.ws.WebServiceMessage;
|
||||
import org.springframework.xml.transform.StringResult;
|
||||
import org.springframework.xml.validation.XmlValidator;
|
||||
import org.springframework.xml.validation.XmlValidatorFactory;
|
||||
import org.xml.sax.SAXParseException;
|
||||
@@ -59,14 +58,6 @@ public abstract class AbstractSoapMessageTestCase extends AbstractWebServiceMess
|
||||
assertFalse("Attachment iterator has too many elements", iterator.hasNext());
|
||||
}
|
||||
|
||||
public void testWriteTo() throws Exception {
|
||||
StringResult stringResult = new StringResult();
|
||||
transformer.transform(soapMessage.getEnvelope().getSource(), stringResult);
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
soapMessage.writeTo(os);
|
||||
assertXMLEqual(stringResult.toString(), os.toString("UTF-8"));
|
||||
}
|
||||
|
||||
public void testValidate() throws Exception {
|
||||
XmlValidator validator =
|
||||
XmlValidatorFactory.createValidator(getSoapSchemas(), XmlValidatorFactory.SCHEMA_W3C_XML);
|
||||
@@ -84,5 +75,9 @@ public abstract class AbstractSoapMessageTestCase extends AbstractWebServiceMess
|
||||
|
||||
protected abstract Resource[] getSoapSchemas();
|
||||
|
||||
public abstract void testGetVersion() throws Exception;
|
||||
|
||||
public abstract void testWriteToTransportOutputStream() throws Exception;
|
||||
|
||||
public abstract void testWriteToTransportResponseAttachment() throws Exception;
|
||||
}
|
||||
|
||||
@@ -1,73 +1,16 @@
|
||||
package org.springframework.ws.soap.axiom;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import org.apache.axiom.om.OMAbstractFactory;
|
||||
import org.apache.axiom.soap.SOAPFactory;
|
||||
import org.springframework.ws.soap.SoapBody;
|
||||
import org.springframework.ws.soap.SoapVersion;
|
||||
import org.springframework.ws.soap.soap11.AbstractSoap11BodyTestCase;
|
||||
import org.springframework.ws.soap.soap11.Soap11Body;
|
||||
import org.springframework.ws.soap.soap11.Soap11Fault;
|
||||
import org.springframework.xml.transform.StringResult;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class AxiomSoap11BodyTest extends AbstractSoap11BodyTestCase {
|
||||
|
||||
private AxiomSoapMessage axiomSoapMessage;
|
||||
|
||||
private DocumentBuilder documentBuilder;
|
||||
|
||||
protected SoapBody createSoapBody() throws Exception {
|
||||
SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
|
||||
axiomSoapMessage = new AxiomSoapMessage(axiomFactory);
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
documentBuilderFactory.setNamespaceAware(true);
|
||||
documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
AxiomSoapMessage axiomSoapMessage = new AxiomSoapMessage(axiomFactory);
|
||||
return axiomSoapMessage.getSoapBody();
|
||||
}
|
||||
|
||||
public void testAddFault() throws Exception {
|
||||
QName faultCode = new QName("http://www.springframework.org", "fault", "spring");
|
||||
String faultString = "faultString";
|
||||
Soap11Fault fault = ((Soap11Body) soapBody).addFault(faultCode, faultString, null);
|
||||
assertNotNull("Null returned", fault);
|
||||
assertTrue("SoapBody has no fault", soapBody.hasFault());
|
||||
assertNotNull("SoapBody has no fault", soapBody.getFault());
|
||||
assertEquals("Invalid fault code", faultCode, fault.getFaultCode());
|
||||
assertEquals("Invalid fault string", faultString, fault.getFaultStringOrReason());
|
||||
String actor = "http://www.springframework.org/actor";
|
||||
fault.setFaultActorOrRole(actor);
|
||||
assertEquals("Invalid fault actor", actor, fault.getFaultActorOrRole());
|
||||
assertPayloadEqual("<SOAP-ENV:Fault xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' " +
|
||||
"xmlns:spring='http://www.springframework.org'>" + "<faultcode>spring:fault</faultcode>" +
|
||||
"<faultstring>" + faultString + "</faultstring>" + "<faultactor>" + actor + "</faultactor>" +
|
||||
"</SOAP-ENV:Fault>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Overriden because of http://issues.apache.org/jira/browse/WSCOMMONS-38. Axiom does not return valid xml
|
||||
*/
|
||||
protected void assertPayloadEqual(String expectedPayload) throws Exception {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
axiomSoapMessage.writeTo(os);
|
||||
Document document = documentBuilder.parse(new ByteArrayInputStream(os.toByteArray()));
|
||||
NodeList nodes = document.getElementsByTagNameNS(SoapVersion.SOAP_11.getEnvelopeNamespaceUri(), "Body");
|
||||
assertEquals("No Body found", 1, nodes.getLength());
|
||||
assertEquals("No Body found", Node.ELEMENT_NODE, nodes.item(0).getNodeType());
|
||||
Element bodyElement = (Element) nodes.item(0);
|
||||
Element firstChild = (Element) bodyElement.getFirstChild();
|
||||
Result result = new StringResult();
|
||||
transformer.transform(new DOMSource(firstChild), result);
|
||||
assertXMLEqual("Invalid payload contents", expectedPayload, result.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class AxiomSoap11MessageTest extends AbstractSoap11MessageTestCase {
|
||||
}
|
||||
|
||||
public void testAttachments() throws Exception {
|
||||
// Attachment support not supported
|
||||
// Attachment not supported
|
||||
}
|
||||
|
||||
public void testWriteToTransportResponseAttachment() throws Exception {
|
||||
|
||||
@@ -36,6 +36,7 @@ public class SaajSoap11MessageTest extends AbstractSoap11MessageTestCase {
|
||||
protected final SoapMessage createSoapMessage() throws Exception {
|
||||
MessageFactory messageFactory = MessageFactory.newInstance();
|
||||
saajMessage = messageFactory.createMessage();
|
||||
saajMessage.getSOAPHeader().detachNode();
|
||||
return new SaajSoapMessage(saajMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ public class SaajSoap12MessageTest extends AbstractSoap12MessageTestCase {
|
||||
protected SoapMessage createSoapMessage() throws Exception {
|
||||
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
|
||||
saajMessage = messageFactory.createMessage();
|
||||
saajMessage.getSOAPHeader().detachNode();
|
||||
return new SaajSoapMessage(saajMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -276,8 +276,8 @@ public class PayloadValidatingInterceptorTest extends XMLTestCase {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
messageContext.getResponse().writeTo(os);
|
||||
assertXMLEqual("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
|
||||
"<soapenv:Header />" + "<soapenv:Body>" + "<soapenv:Fault>" + "<faultcode>soapenv:Client</faultcode>" +
|
||||
"<faultstring>Validation error</faultstring>" + "<detail>" +
|
||||
"<soapenv:Body>" + "<soapenv:Fault>" + "<faultcode>soapenv:Client</faultcode>" +
|
||||
"<faultstring xml:lang='en'>Validation error</faultstring>" + "<detail>" +
|
||||
"<spring-ws:ValidationError xmlns:spring-ws=\"http://springframework.org/spring-ws\">Message 1</spring-ws:ValidationError>" +
|
||||
"<spring-ws:ValidationError xmlns:spring-ws=\"http://springframework.org/spring-ws\">Message 2</spring-ws:ValidationError>" +
|
||||
"</detail>" + "</soapenv:Fault>" + "</soapenv:Body>" + "</soapenv:Envelope>", os.toString());
|
||||
|
||||
@@ -37,13 +37,6 @@ public abstract class AbstractSoap11MessageTestCase extends AbstractSoapMessageT
|
||||
Assert.assertEquals("Invalid SOAP version", SoapVersion.SOAP_11, soapMessage.getVersion());
|
||||
}
|
||||
|
||||
public void testWriteToOutputStream() throws Exception {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
soapMessage.writeTo(outputStream);
|
||||
assertXMLEqual("<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Header/><Body/></Envelope>",
|
||||
new String(outputStream.toByteArray(), "UTF-8"));
|
||||
}
|
||||
|
||||
public void testWriteToTransportOutputStream() throws Exception {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
MockTransportOutputStream tos = new MockTransportOutputStream(bos);
|
||||
@@ -51,8 +44,7 @@ public abstract class AbstractSoap11MessageTestCase extends AbstractSoapMessageT
|
||||
soapMessage.setSoapAction(soapAction);
|
||||
soapMessage.writeTo(tos);
|
||||
String result = bos.toString("UTF-8");
|
||||
assertXMLEqual("<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Header/><Body/></Envelope>",
|
||||
result);
|
||||
assertXMLEqual("<Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Body/></Envelope>", result);
|
||||
String contentType = (String) tos.getHeaders().get("Content-Type");
|
||||
assertTrue("Invalid Content-Type set", contentType.indexOf(SoapVersion.SOAP_11.getContentType()) != -1);
|
||||
String resultSoapAction = (String) tos.getHeaders().get("SOAPAction");
|
||||
|
||||
@@ -33,25 +33,18 @@ public abstract class AbstractSoap12MessageTestCase extends AbstractSoapMessageT
|
||||
Assert.assertEquals("Invalid SOAP version", SoapVersion.SOAP_12, soapMessage.getVersion());
|
||||
}
|
||||
|
||||
public void testWriteTo() throws Exception {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
soapMessage.writeTo(outputStream);
|
||||
assertXMLEqual("<Envelope xmlns='http://www.w3.org/2003/05/soap-envelope'><Header/><Body/></Envelope>",
|
||||
new String(outputStream.toByteArray(), "UTF-8"));
|
||||
}
|
||||
|
||||
protected final Resource[] getSoapSchemas() {
|
||||
return new Resource[]{new ClassPathResource("xml.xsd", AbstractSoap12MessageTestCase.class),
|
||||
new ClassPathResource("soap12.xsd", AbstractSoap12MessageTestCase.class)};
|
||||
}
|
||||
|
||||
public void testWriteToTransportResponse() throws Exception {
|
||||
public void testWriteToTransportOutputStream() throws Exception {
|
||||
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
MockTransportOutputStream tos = new MockTransportOutputStream(bos);
|
||||
soapMessage.writeTo(tos);
|
||||
String result = bos.toString("UTF-8");
|
||||
|
||||
assertXMLEqual("<Envelope xmlns='http://www.w3.org/2003/05/soap-envelope'><Header/><Body/></Envelope>", result);
|
||||
assertXMLEqual("<Envelope xmlns='http://www.w3.org/2003/05/soap-envelope'><Body/></Envelope>", result);
|
||||
String contentType = (String) tos.getHeaders().get("Content-Type");
|
||||
assertTrue("Invalid Content-Type set", contentType.indexOf(SoapVersion.SOAP_12.getContentType()) != -1);
|
||||
}
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -459,12 +459,12 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
||||
<artifactId>axiom-api</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
||||
<artifactId>axiom-impl</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<version>1.2.3</version>
|
||||
</dependency>
|
||||
<!-- WSDL dependencies -->
|
||||
<dependency>
|
||||
|
||||
Reference in New Issue
Block a user