Made Soap11Body return Soap11Fault, and Soap12Body return Soap12Fault

This commit is contained in:
Arjen Poutsma
2010-08-02 09:14:34 +00:00
parent 133e57ed74
commit ccfff34603
6 changed files with 59 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2005-2010 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.
@@ -19,6 +19,13 @@ package org.springframework.ws.soap.axiom;
import java.util.Locale;
import javax.xml.namespace.QName;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap11.Soap11Body;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.xml.namespace.QNameUtils;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
@@ -29,14 +36,6 @@ import org.apache.axiom.soap.SOAPFaultCode;
import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.soap.SOAPProcessingException;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap11.Soap11Body;
import org.springframework.ws.soap.soap11.Soap11Fault;
import org.springframework.xml.namespace.QNameUtils;
/**
* Axiom-specific version of <code>org.springframework.ws.soap.Soap11Body</code>.
*
@@ -55,22 +54,22 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
public SoapFault addMustUnderstandFault(String faultString, Locale locale) {
public Soap11Fault addMustUnderstandFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_MUST_UNDERSTAND, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
public SoapFault addClientOrSenderFault(String faultString, Locale locale) {
public Soap11Fault addClientOrSenderFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_SENDER, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
public SoapFault addServerOrReceiverFault(String faultString, Locale locale) {
public Soap11Fault addServerOrReceiverFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_RECEIVER, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
public SoapFault addVersionMismatchFault(String faultString, Locale locale) {
public Soap11Fault addVersionMismatchFault(String faultString, Locale locale) {
SOAPFault fault = addStandardFault(SOAP11Constants.FAULT_CODE_VERSION_MISMATCH, faultString, locale);
return new AxiomSoap11Fault(fault, getAxiomFactory());
}
@@ -148,7 +147,7 @@ class AxiomSoap11Body extends AxiomSoapBody implements Soap11Body {
faultReason.addAttribute(langAttribute);
}
public SoapFault getFault() {
public Soap11Fault getFault() {
SOAPFault axiomFault = getAxiomBody().getFault();
return axiomFault != null ? new AxiomSoap11Fault(axiomFault, getAxiomFactory()) : null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2010 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.
@@ -19,6 +19,11 @@ package org.springframework.ws.soap.axiom;
import java.util.Locale;
import javax.xml.namespace.QName;
import org.springframework.util.Assert;
import org.springframework.ws.soap.axiom.support.AxiomUtils;
import org.springframework.ws.soap.soap12.Soap12Body;
import org.springframework.ws.soap.soap12.Soap12Fault;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPFactory;
@@ -29,12 +34,6 @@ 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;
/**
* Axiom-specific version of <code>org.springframework.ws.soap.Soap12Body</code>.
*
@@ -47,25 +46,25 @@ class AxiomSoap12Body extends AxiomSoapBody implements Soap12Body {
super(axiomBody, axiomFactory, payloadCaching);
}
public SoapFault addMustUnderstandFault(String reason, Locale locale) {
public Soap12Fault addMustUnderstandFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_MUST_UNDERSTAND, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
public SoapFault addClientOrSenderFault(String reason, Locale locale) {
public Soap12Fault addClientOrSenderFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_SENDER, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
public SoapFault addServerOrReceiverFault(String reason, Locale locale) {
public Soap12Fault addServerOrReceiverFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_RECEIVER, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
}
public SoapFault addVersionMismatchFault(String reason, Locale locale) {
public Soap12Fault addVersionMismatchFault(String reason, Locale locale) {
Assert.notNull(locale, "No locale given");
SOAPFault fault = addStandardFault(SOAP12Constants.FAULT_CODE_VERSION_MISMATCH, reason, locale);
return new AxiomSoap12Fault(fault, getAxiomFactory());
@@ -98,7 +97,7 @@ class AxiomSoap12Body extends AxiomSoapBody implements Soap12Body {
}
}
public SoapFault getFault() {
public Soap12Fault getFault() {
SOAPFault axiomFault = getAxiomBody().getFault();
return axiomFault != null ? new AxiomSoap12Fault(axiomFault, getAxiomFactory()) : null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2005-2010 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.
@@ -23,7 +23,6 @@ import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;
import org.springframework.util.Assert;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.soap11.Soap11Body;
import org.springframework.ws.soap.soap11.Soap11Fault;
@@ -43,7 +42,7 @@ class SaajSoap11Body extends SaajSoapBody implements Soap11Body {
this.langAttributeOnSoap11FaultString = langAttributeOnSoap11FaultString;
}
public SoapFault getFault() {
public Soap11Fault getFault() {
SOAPFault fault = getImplementation().getFault(getSaajBody());
return fault != null ? new SaajSoap11Fault(fault) : null;
}
@@ -67,19 +66,19 @@ class SaajSoap11Body extends SaajSoapBody implements Soap11Body {
}
}
public SoapFault addClientOrSenderFault(String faultString, Locale locale) {
public Soap11Fault addClientOrSenderFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getClientOrSenderFaultName(), faultString, locale);
}
public SoapFault addMustUnderstandFault(String faultString, Locale locale) {
public Soap11Fault addMustUnderstandFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getMustUnderstandFaultName(), faultString, locale);
}
public SoapFault addServerOrReceiverFault(String faultString, Locale locale) {
public Soap11Fault addServerOrReceiverFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getServerOrReceiverFaultName(), faultString, locale);
}
public SoapFault addVersionMismatchFault(String faultString, Locale locale) {
public Soap11Fault addVersionMismatchFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_11.getVersionMismatchFaultName(), faultString, locale);
}

View File

@@ -23,7 +23,6 @@ import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFault;
import org.springframework.util.Assert;
import org.springframework.ws.soap.SoapFault;
import org.springframework.ws.soap.SoapVersion;
import org.springframework.ws.soap.soap12.Soap12Body;
import org.springframework.ws.soap.soap12.Soap12Fault;
@@ -40,24 +39,24 @@ class SaajSoap12Body extends SaajSoapBody implements Soap12Body {
super(body);
}
public SoapFault getFault() {
public Soap12Fault getFault() {
SOAPFault fault = getImplementation().getFault(getSaajBody());
return fault != null ? new SaajSoap12Fault(fault) : null;
}
public SoapFault addClientOrSenderFault(String faultString, Locale locale) {
public Soap12Fault addClientOrSenderFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getClientOrSenderFaultName(), faultString, locale);
}
public SoapFault addMustUnderstandFault(String faultString, Locale locale) {
public Soap12Fault addMustUnderstandFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getMustUnderstandFaultName(), faultString, locale);
}
public SoapFault addServerOrReceiverFault(String faultString, Locale locale) {
public Soap12Fault addServerOrReceiverFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getServerOrReceiverFaultName(), faultString, locale);
}
public SoapFault addVersionMismatchFault(String faultString, Locale locale) {
public Soap12Fault addVersionMismatchFault(String faultString, Locale locale) {
return addFault(SoapVersion.SOAP_12.getVersionMismatchFaultName(), faultString, locale);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2010 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.
@@ -44,4 +44,13 @@ public interface Soap11Body extends SoapBody {
*/
Soap11Fault addFault(QName faultCode, String faultString, Locale faultStringLocale) throws SoapFaultException;
Soap11Fault getFault();
Soap11Fault addMustUnderstandFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
Soap11Fault addClientOrSenderFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
Soap11Fault addServerOrReceiverFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
Soap11Fault addVersionMismatchFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006 the original author or authors.
* Copyright 2005-2010 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.
@@ -20,6 +20,7 @@ import java.util.Locale;
import javax.xml.namespace.QName;
import org.springframework.ws.soap.SoapBody;
import org.springframework.ws.soap.SoapFaultException;
/**
* Subinterface of <code>SoapBody</code> that exposes SOAP 1.2 functionality. Necessary because SOAP 1.1 differs from
@@ -40,5 +41,16 @@ public interface Soap12Body extends SoapBody {
* @param locale the language of the fault reason
* @return the created <code>SoapFault</code>
*/
Soap12Fault addDataEncodingUnknownFault(QName[] subcodes, String reason, Locale locale);
Soap12Fault addDataEncodingUnknownFault(QName[] subcodes, String reason, Locale locale) throws SoapFaultException;
Soap12Fault getFault();
Soap12Fault addMustUnderstandFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
Soap12Fault addClientOrSenderFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
Soap12Fault addServerOrReceiverFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
Soap12Fault addVersionMismatchFault(String faultStringOrReason, Locale locale) throws SoapFaultException;
}