Author: jim.ma
Date: 2010-02-27 06:34:52 -0500 (Sat, 27 Feb 2010)
New Revision: 11698
Modified:
stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/MapRequiredException.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/AddressingConstantsImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
Log:
[JBWS-2944]:throw MapRequriedException instead when required element is missing
Modified:
stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/MapRequiredException.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/MapRequiredException.java 2010-02-27
10:36:18 UTC (rev 11697)
+++
stack/native/trunk/modules/core/src/main/java/javax/xml/ws/addressing/MapRequiredException.java 2010-02-27
11:34:52 UTC (rev 11698)
@@ -38,7 +38,8 @@
public MapRequiredException(QName name)
{
- super(fMessage + ": " + name);
+ //TODO:Add the exact missing header qname in soap header
+ super(fMessage);
}
public QName getSubcode()
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2010-02-27
10:36:18 UTC (rev 11697)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/core/jaxws/SOAPFaultHelperJAXWS.java 2010-02-27
11:34:52 UTC (rev 11698)
@@ -38,6 +38,7 @@
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.WebServiceException;
+import javax.xml.ws.addressing.MapRequiredException;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.soap.SOAPFaultException;
@@ -263,8 +264,17 @@
SOAPBody soapBody = soapMessage.getSOAPBody();
- SOAPFault soapFault = soapBody.addFault(getFallbackFaultCode(),
getFallbackFaultString(ex));
-
+ SOAPFault soapFault = null;
+ if(ex instanceof MapRequiredException)
+ {
+ MapRequiredException addrException = (MapRequiredException)ex;
+ soapFault = soapBody.addFault(addrException.getSubcode(),
addrException.getMessage());
+ }
+ else
+ {
+ soapFault = soapBody.addFault(getFallbackFaultCode(),
getFallbackFaultString(ex));
+ }
+
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
SerializationContext serContext = msgContext.getSerializationContext();
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/AddressingConstantsImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/AddressingConstantsImpl.java 2010-02-27
10:36:18 UTC (rev 11697)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/AddressingConstantsImpl.java 2010-02-27
11:34:52 UTC (rev 11698)
@@ -155,7 +155,7 @@
public QName getMapRequiredQName()
{
- return new QName(URI_ADDRESSING, "MessageInformationHeaderRequired",
PREFIX_ADDRESSING);
+ return new QName(URI_ADDRESSING, "MessageAddressingHeaderRequired",
PREFIX_ADDRESSING);
}
public QName getDestinationUnreachableQName()
@@ -200,6 +200,6 @@
public String getMapRequiredText()
{
- return "Map Required";
+ return "A required header representing a Message Addressing Property is not
present";
}
}
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2010-02-27
10:36:18 UTC (rev 11697)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2010-02-27
11:34:52 UTC (rev 11698)
@@ -39,6 +39,7 @@
import javax.xml.ws.addressing.AddressingConstants;
import javax.xml.ws.addressing.AddressingException;
import javax.xml.ws.addressing.AttributedURI;
+import javax.xml.ws.addressing.MapRequiredException;
import javax.xml.ws.addressing.ReferenceParameters;
import javax.xml.ws.addressing.Relationship;
import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
@@ -79,10 +80,10 @@
private String getRequiredHeaderContent(SOAPHeader soapHeader, QName qname)
{
Element element = DOMUtils.getFirstChildElement(soapHeader, qname);
- if(null == element) throw new AddressingException("Required element
"+qname+" is missing");
+ if(null == element) throw new MapRequiredException(qname);
String value = DOMUtils.getTextContent(element);
- if(null == value || value.equals("")) throw new
AddressingException("Required element "+qname+" is missing");
+ if(null == value || value.equals("")) throw new MapRequiredException(qname);
return value;
}
Show replies by date