Author: barrettj
Date: Fri Jan 14 19:02:46 2011
New Revision: 1059115
URL: http://svn.apache.org/viewvc?rev=1059115&view=rev
Log:
AXIS2-4922. Patch contributed by Katherine Sanders. Fixes to WS-A metadata
action code.
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java?rev=1059115&r1=1059114&r2=1059115&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
Fri Jan 14 19:02:46 2011
@@ -300,11 +300,23 @@ public abstract class JavaDispatcher imp
MessageContext response) {
AxisOperation operation =
request.getOperationDescription().getAxisOperation();
if (operation != null) {
- exception = ClassUtils.getRootCause(exception);
- String action =
operation.getFaultAction(exception.getClass().getName());
-
- if (action != null)
+ exception = ClassUtils.getRootCause(exception);
+ String className = exception.getClass().getName();
+ String action = operation.getFaultAction(className);
+ if (action == null) {
+ className =
className.substring((className.lastIndexOf('.'))+1);
+ action = operation.getFaultAction(className);
+ }
+ if (log.isDebugEnabled()) {
+ for(String faultActionName : operation.getFaultActionNames())
+ log.debug("Fault action map entry: key = " +
faultActionName + ", value = " + operation.getFaultAction(faultActionName));
+ }
+ if (action != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Setting fault action " + action + " for
Exception: "+className);
+ }
response.getAxisMessageContext().setWSAAction(action);
+ }
}
}
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java?rev=1059115&r1=1059114&r2=1059115&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
Fri Jan 14 19:02:46 2011
@@ -63,7 +63,7 @@ public class WSDL11ActionHelper {
public static String getActionFromInputElement(Definition def, PortType
wsdl4jPortType,
Operation op, Input input) {
String result = getWSAWActionExtensionAttribute(input);
- if (result == null) {
+ if (result == null || result.equals("")) {
result = WSDL11DefaultActionPatternHelper
.generateActionFromInputElement(def, wsdl4jPortType, op,
input);
}
@@ -83,7 +83,7 @@ public class WSDL11ActionHelper {
public static String getActionFromOutputElement(Definition def, PortType
wsdl4jPortType,
Operation op, Output
output) {
String result = getWSAWActionExtensionAttribute(output);
- if (result == null) {
+ if (result == null || result.equals("")) {
result = WSDL11DefaultActionPatternHelper
.generateActionFromOutputElement(def, wsdl4jPortType, op,
output);
}
@@ -103,7 +103,7 @@ public class WSDL11ActionHelper {
public static String getActionFromFaultElement(Definition def, PortType
wsdl4jPortType,
Operation op, Fault fault) {
String result = getWSAWActionExtensionAttribute(fault);
- if (result == null) {
+ if (result == null || result.equals("")) {
result = WSDL11DefaultActionPatternHelper
.generateActionFromFaultElement(def, wsdl4jPortType, op,
fault);
}
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1059115&r1=1059114&r2=1059115&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Fri Jan 14 19:02:46 2011
@@ -1545,6 +1545,37 @@ public class WSDL11ToAxisServiceBuilder
if (action != null) {
axisOperation.addFaultAction(fault.getName(), action);
}
+
+ // Also add mapping from Exception name to fault action
+ String faultMessageName = axisFaultMessage.getName();
+ if (null != faultMessageName) {
+ char firstChar = faultMessageName.charAt(0);
+ String upperChar = String.valueOf(firstChar).toUpperCase();
+ String nameWithoutFirstChar = faultMessageName.substring(1);
+ String exceptionClassName =
upperChar.concat(nameWithoutFirstChar);
+ if (log.isDebugEnabled()) {
+ log.debug("Searching for fault action using
faultMessageName = "+faultMessageName+", exceptionClassName =
"+exceptionClassName);
+ }
+
+ String faultAction =
axisOperation.getFaultAction(exceptionClassName);
+ if (faultAction == null) {
+ faultAction =
WSDL11ActionHelper.getActionFromFaultElement(dif,
+
wsdl4jPortType,
+
wsdl4jOperation, fault);
+ if (log.isDebugEnabled()) {
+ log.debug("Fault action didn't previously exist,
getting it from WSDL: "+faultAction);
+ }
+ }
+ if (faultAction != null) {
+ axisOperation.addFaultAction(exceptionClassName,
faultAction);
+
axisOperation.addFaultAction(exceptionClassName+"_Exception", faultAction);
+ if (log.isDebugEnabled()) {
+ log.debug("Adding fault action entry:
"+exceptionClassName+"="+faultAction);
+ log.debug("Adding fault action entry:
"+exceptionClassName+"_Exception"+"="+faultAction);
+ }
+ }
+ }
+
axisOperation.setFaultMessages(axisFaultMessage);
}
return axisOperation;