You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/03/08 00:23:24 UTC
svn commit: r634860 - in /webservices/axis2/trunk/java/modules:
kernel/src/org/apache/axis2/addressing/wsdl/
metadata/src/org/apache/axis2/jaxws/description/
metadata/src/org/apache/axis2/jaxws/description/builder/
metadata/src/org/apache/axis2/jaxws/d...
Author: pradine
Date: Fri Mar 7 15:23:23 2008
New Revision: 634860
URL: http://svn.apache.org/viewvc?rev=634860&view=rev
Log:
Changes relating to AXIS2-3573.
Added:
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ActionAnnot.java (with props)
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/FaultActionAnnot.java (with props)
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescriptionJava.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java?rev=634860&r1=634859&r2=634860&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java Fri Mar 7 15:23:23 2008
@@ -152,7 +152,7 @@
if (messageExchangePattern.indexOf("in-out") >= 0) {
inputName += REQUEST;
} else if (messageExchangePattern.indexOf("out-in") >= 0) {
- inputName += REQUEST;
+ inputName += RESPONSE;
}
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescriptionJava.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescriptionJava.java?rev=634860&r1=634859&r2=634860&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescriptionJava.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescriptionJava.java Fri Mar 7 15:23:23 2008
@@ -25,6 +25,7 @@
import javax.jws.WebParam.Mode;
import javax.jws.WebResult;
import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.Action;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
@@ -97,5 +98,7 @@
public Oneway getAnnoOneway();
public boolean isAnnoOneWay();
+
+ public Action getAnnoAction();
}
Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ActionAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ActionAnnot.java?rev=634860&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ActionAnnot.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ActionAnnot.java Fri Mar 7 15:23:23 2008
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.description.builder;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.ws.Action;
+import javax.xml.ws.FaultAction;
+
+public class ActionAnnot implements Action {
+
+ private FaultAction[] fault;
+ private String input;
+ private String output;
+
+ private ActionAnnot() {
+ }
+
+ private ActionAnnot(FaultAction[] fault, String input, String output) {
+ this.fault = fault;
+ this.input = input;
+ this.output = output;
+ }
+
+ public static ActionAnnot createActionAnnotImpl() {
+ return new ActionAnnot();
+ }
+
+ public static ActionAnnot createActionAnnotImpl(FaultAction[] fault, String input, String output) {
+ return new ActionAnnot(fault, input, output);
+ }
+
+ public void setFault(FaultAction[] fault) {
+ this.fault = fault;
+ }
+
+ public void setInput(String input) {
+ this.input = input;
+ }
+
+ public void setOutput(String output) {
+ this.output = output;
+ }
+
+ public FaultAction[] fault() {
+ return fault;
+ }
+
+ public String input() {
+ return input;
+ }
+
+ public String output() {
+ return output;
+ }
+
+ //hmm, should we really do this
+ public Class<? extends Annotation> annotationType() {
+ return Annotation.class;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ String newLine = "\n";
+ sb.append(newLine);
+ sb.append("@Action.fault= " + fault);
+ sb.append(newLine);
+ sb.append("@Action.input= " + input);
+ sb.append(newLine);
+ sb.append("@Action.output= " + output);
+ sb.append(newLine);
+ return sb.toString();
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/ActionAnnot.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/FaultActionAnnot.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/FaultActionAnnot.java?rev=634860&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/FaultActionAnnot.java (added)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/FaultActionAnnot.java Fri Mar 7 15:23:23 2008
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.description.builder;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.ws.FaultAction;
+
+public class FaultActionAnnot implements FaultAction {
+
+ private Class className;
+ private String value;
+
+ private FaultActionAnnot() {
+ }
+
+ private FaultActionAnnot(Class className, String value) {
+ this.className = className;
+ this.value = value;
+ }
+
+ public static FaultActionAnnot createFaultActionAnnotImpl() {
+ return new FaultActionAnnot();
+ }
+
+ public static FaultActionAnnot createFaultActionAnnotImpl(Class className, String value) {
+ return new FaultActionAnnot(className, value);
+ }
+
+ public void setClassName(Class className) {
+ this.className = className;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public Class className() {
+ return className;
+ }
+
+ public String value() {
+ return value;
+ }
+
+ //hmm, should we really do this
+ public Class<? extends Annotation> annotationType() {
+ return Annotation.class;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ String newLine = "\n";
+ sb.append(newLine);
+ sb.append("@FaultAction.className= " + className);
+ sb.append(newLine);
+ sb.append("@FaultAction.value= " + value);
+ sb.append(newLine);
+ return sb.toString();
+ }
+}
Propchange: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/FaultActionAnnot.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java?rev=634860&r1=634859&r2=634860&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/MethodDescriptionComposite.java Fri Mar 7 15:23:23 2008
@@ -49,6 +49,8 @@
private List<ParameterDescriptionComposite> parameterDescriptions;//TODO EDIT CHECK: only on methods of SEI
private DescriptionBuilderComposite parentDBC;
+
+ private ActionAnnot actionAnnot;
/*
* Default Constructor
@@ -195,6 +197,11 @@
return webServiceRefAnnot;
}
+ /** @return Returns the actionAnnot. */
+ public ActionAnnot getActionAnnot() {
+ return actionAnnot;
+ }
+
/** @return Returns the exceptions. */
public String[] getExceptions() {
return exceptions;
@@ -286,6 +293,11 @@
this.webServiceRefAnnot = webServiceRefAnnot;
}
+ /** @param actionAnnot The actionAnnot to set. */
+ public void setActionAnnot(ActionAnnot actionAnnot) {
+ this.actionAnnot = actionAnnot;
+ }
+
/** @param parameterDescription The parameterDescription to add to the set. */
public void addParameterDescriptionComposite(
ParameterDescriptionComposite parameterDescription) {
@@ -434,6 +446,12 @@
sb.append(newLine);
sb.append("WebServiceRef: ");
sb.append(webServiceRefAnnot.toString());
+ }
+
+ if (actionAnnot != null) {
+ sb.append(newLine);
+ sb.append("Action: ");
+ sb.append(actionAnnot.toString());
}
if (handlerChainAnnot != null) {
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java?rev=634860&r1=634859&r2=634860&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/converter/JavaMethodsToMDCConverter.java Fri Mar 7 15:23:23 2008
@@ -18,6 +18,8 @@
*/
package org.apache.axis2.jaxws.description.builder.converter;
+import org.apache.axis2.jaxws.description.builder.ActionAnnot;
+import org.apache.axis2.jaxws.description.builder.FaultActionAnnot;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.RequestWrapperAnnot;
@@ -29,6 +31,8 @@
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebResult;
+import javax.xml.ws.Action;
+import javax.xml.ws.FaultAction;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.WebEndpoint;
@@ -79,6 +83,7 @@
attachWebMethodAnnotation(mdc, method);
attachWebResultAnnotation(mdc, method);
attachWebServiceRefAnnotation(mdc, method);
+ attachActionAnnotation(mdc, method);
if (method.getGenericParameterTypes().length > 0) {
JavaParamToPDCConverter paramConverter = new JavaParamToPDCConverter(
method.getGenericParameterTypes(), method.getParameterAnnotations());
@@ -283,6 +288,39 @@
private void attachWebServiceRefAnnotation(MethodDescriptionComposite mdc, Method
method) {
ConverterUtils.attachWebServiceRefAnnotation(mdc, method);
+ }
+
+ /**
+ * This method will drive the attachment of @Action annotation data to the
+ * <code>MethodDescriptionComposite</code>
+ *
+ * @param mdc - <code>MethodDescriptionComposite</code>
+ * @param method - <code>Method</code>
+ */
+ private void attachActionAnnotation(MethodDescriptionComposite mdc, Method
+ method) {
+ Action action = (Action)ConverterUtils.getAnnotation(Action.class,
+ method);
+ if (action != null) {
+ ActionAnnot actionAnnot = ActionAnnot.createActionAnnotImpl();
+ FaultAction[] faults = action.fault();
+
+ if (faults != null && faults.length != 0) {
+ List<FaultAction> list = new ArrayList<FaultAction>();
+ for (FaultAction fault : faults) {
+ FaultActionAnnot faultAnnot =
+ FaultActionAnnot.createFaultActionAnnotImpl();
+ faultAnnot.setClassName(fault.className());
+ faultAnnot.setValue(fault.value());
+ list.add(faultAnnot);
+ }
+ actionAnnot.setFault(list.toArray(new FaultAction[0]));
+ }
+
+ actionAnnot.setInput(action.input());
+ actionAnnot.setOutput(action.output());
+ mdc.setActionAnnot(actionAnnot);
+ }
}
/**
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java?rev=634860&r1=634859&r2=634860&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/FaultDescriptionImpl.java Fri Mar 7 15:23:23 2008
@@ -92,7 +92,7 @@
// no need for defaults here. The exceptionClass stored in this
// FaultDescription object is one that has been declared to be
// thrown from the service method
- return exceptionClass.getCanonicalName();
+ return exceptionClass.getName();
} else {
return composite.getClassName();
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=634860&r1=634859&r2=634860&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Fri Mar 7 15:23:23 2008
@@ -31,7 +31,6 @@
import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.AttachmentDescription;
-import org.apache.axis2.jaxws.description.AttachmentType;
import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
import org.apache.axis2.jaxws.description.EndpointInterfaceDescription;
import org.apache.axis2.jaxws.description.FaultDescription;
@@ -64,9 +63,10 @@
import javax.wsdl.BindingOutput;
import javax.wsdl.Definition;
import javax.wsdl.extensions.AttributeExtensible;
-import javax.xml.bind.annotation.XmlList;
import javax.xml.namespace.QName;
+import javax.xml.ws.Action;
import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.FaultAction;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.Response;
import javax.xml.ws.ResponseWrapper;
@@ -131,6 +131,9 @@
private String responseWrapperLocalName;
private String responseWrapperTargetNamespace;
private String responseWrapperClassName;
+
+ // ANNOTATION: @Action
+ private Action actionAnnotation;
// ANNOTATION: @SOAPBinding
// Note this is the Method-level annotation. See EndpointInterfaceDescription for the Type-level annotation
@@ -318,44 +321,56 @@
String targetNS = getEndpointInterfaceDescriptionImpl().getTargetNamespace();
String portTypeName = getEndpointInterfaceDescriptionImpl().getPortType().getLocalPart();
ArrayList inputActions = new ArrayList();
+ Action action = getAnnoAction();
//We don't have a name at this point, shouldn't matter if we have the MEP
//String inputName = newAxisOperation.getName().getLocalPart();
String inputName = null;
- String inputAction =
- WSDL11ActionHelper.getInputActionFromStringInformation( messageExchangePattern,
+ String inputAction = null;
+
+ //Check the annotation first, if it exists.
+ if (action != null) {
+ inputAction = action.output();
+ }
+
+ //If we still don't have an action then fall back to the Default Action Pattern.
+ if (inputAction == null) {
+ inputAction = WSDL11ActionHelper.getInputActionFromStringInformation( messageExchangePattern,
targetNS,
portTypeName,
newAxisOperation.getName().getLocalPart(),
inputName);
-
- if (inputAction != null) {
- inputActions.add(inputAction);
- newAxisOperation.setWsamappingList(inputActions);
}
+
+ inputActions.add(inputAction);
+ newAxisOperation.setWsamappingList(inputActions);
+ //Map the action to the operation on the actual axisService
+ //TODO: Determine whether this should be done at a higher level in the
+ // description hierarchy
+ getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getAxisService().mapActionToOperation(inputAction, newAxisOperation);
//set the OUTPUT ACTION
//We don't have a name at this point, shouldn't matter if we have the MEP
//String outputName = newAxisOperation.getName().getLocalPart(); //REVIEW:
String outputName = null;
- String outputAction =
- WSDL11ActionHelper.getOutputActionFromStringInformation( messageExchangePattern,
+ String outputAction = null;
+
+ //Check the annotation first, if it exists.
+ if (action != null) {
+ outputAction = action.input();
+ }
+
+ if (outputAction == null) {
+ outputAction = WSDL11ActionHelper.getOutputActionFromStringInformation( messageExchangePattern,
targetNS,
portTypeName,
newAxisOperation.getName().getLocalPart(),
outputName);
-
- if (outputAction != null) {
- newAxisOperation.setOutputAction(outputAction);
}
-
- //Map the action to the operation on the actual axisService
- //TODO: Determine whether this should be done at a higher level in the
- // description hierarchy
- getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getAxisService().mapActionToOperation(outputAction, newAxisOperation);
+ newAxisOperation.setOutputAction(outputAction);
//Set the FAULT ACTION
// Walk the fault information
@@ -379,12 +394,21 @@
newAxisOperation.setFaultMessages(faultMessage);
}
}
-
- //REVIEW: Determine if other axisOperation values may need to be set
- // Currently, the following values are being set on AxisOperation in
- // ServiceBuilder.populateService which we are not setting:
- // AxisOperation.setPolicyInclude()
- // AxisOperation.setFaultMessages()
+
+ //Override the actions based on any FaultAction annotations that are defined.
+ if (action != null) {
+ FaultAction[] faultActions = action.fault();
+
+ if (faultActions != null) {
+ for (FaultAction faultAction : faultActions) {
+ String className = faultAction.className().getName();
+ FaultDescription faultDesc = resolveFaultByExceptionName(className);
+ if (faultDesc != null) {
+ newAxisOperation.addFaultAction(faultDesc.getName(), faultAction.value());
+ }
+ }
+ }
+ }
getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().getAxisService().addOperation(newAxisOperation);
@@ -426,22 +450,31 @@
String targetNS = getEndpointInterfaceDescriptionImpl().getTargetNamespace();
String portTypeName = getEndpointInterfaceDescriptionImpl().getPortType().getLocalPart();
ArrayList inputActions = new ArrayList();
+ Action action = getAnnoAction();
//We don't have a name at this point, shouldn't matter if we have the MEP
//String inputName = newAxisOperation.getName().getLocalPart();
String inputName = null;
- String inputAction =
+ String inputAction = null;
+
+ //Check the annotation first, if it exists.
+ if (action != null) {
+ inputAction = action.input();
+ }
+
+ //If we still don't have an action then fall back to the Default Action Pattern.
+ if (inputAction == null) {
+ inputAction =
WSDL11ActionHelper.getInputActionFromStringInformation(messageExchangePattern,
targetNS,
portTypeName,
newAxisOperation.getName().getLocalPart(),
inputName);
-
- if (inputAction != null) {
- inputActions.add(inputAction);
- newAxisOperation.setWsamappingList(inputActions);
}
+ inputActions.add(inputAction);
+ newAxisOperation.setWsamappingList(inputActions);
+
//Map the action to the operation on the actual axisService
//TODO: Determine whether this should be done at a higher level in the
// description hierarchy
@@ -453,25 +486,35 @@
//We don't have a name at this point, shouldn't matter if we have the MEP
//String outputName = newAxisOperation.getName().getLocalPart(); //REVIEW:
String outputName = null;
- String outputAction =
+ String outputAction = null;
+
+ //Check the annotation first, if it exists.
+ if (action != null) {
+ outputAction = action.output();
+ }
+
+ //If we still don't have an action then fall back to the Default Action Pattern.
+ if (outputAction == null) {
+ outputAction =
WSDL11ActionHelper.getOutputActionFromStringInformation(messageExchangePattern,
targetNS,
portTypeName,
newAxisOperation.getName().getLocalPart(),
outputName);
-
- if (outputAction != null) {
- newAxisOperation.setOutputAction(outputAction);
}
+ newAxisOperation.setOutputAction(outputAction);
+
//Set the FAULT ACTION
// Walk the fault information
FaultDescription[] faultDescs = getFaultDescriptions();
+
+ //Generate actions according to the Default Action Pattern for all declared exceptions.
if (faultDescs != null) {
- for (int i=0; i <faultDescs.length; i++) {
+ for (FaultDescription faultDesc : faultDescs) {
AxisMessage faultMessage = new AxisMessage();
- String faultName = faultDescs[i].getName();
+ String faultName = faultDesc.getName();
faultMessage.setName(faultName);
String faultAction =
@@ -480,21 +523,25 @@
newAxisOperation.getName().getLocalPart(),
faultMessage.getName());
- if (faultAction != null) {
- newAxisOperation.addFaultAction(faultMessage.getName(), faultAction);
- }
+ newAxisOperation.addFaultAction(faultMessage.getName(), faultAction);
newAxisOperation.setFaultMessages(faultMessage);
}
}
-
- //REVIEW: Determine if other axisOperation values may need to be set
- // Currently, the following values are being set on AxisOperation in
- // ServiceBuilder.populateService which we are not setting:
- // AxisOperation.setPolicyInclude()
- // AxisOperation.setWsamappingList()
- // AxisOperation.setOutputAction()
- // AxisOperation.addFaultAction()
- // AxisOperation.setFaultMessages()
+
+ //Override the actions based on any FaultAction annotations that are defined.
+ if (action != null) {
+ FaultAction[] faultActions = action.fault();
+
+ if (faultActions != null) {
+ for (FaultAction faultAction : faultActions) {
+ String className = faultAction.className().getName();
+ FaultDescription faultDesc = resolveFaultByExceptionName(className);
+ if (faultDesc != null) {
+ newAxisOperation.addFaultAction(faultDesc.getName(), faultAction.value());
+ }
+ }
+ }
+ }
// If this is a DOC/LIT/BARE operation, then set the QName of the input AxisMessage to the
// part for the first IN or IN/OUT non-header parameter. If there are no parameters, then don't set
@@ -1484,6 +1531,26 @@
}
}
return soapBindingParameterStyle;
+ }
+
+ // ===========================================
+ // ANNOTATION: Action
+ // ===========================================
+ public Action getAnnoAction() {
+ if (actionAnnotation == null) {
+ if (!isDBC() && seiMethod != null) {
+ actionAnnotation = (Action) getAnnotation(seiMethod, Action.class);
+ }
+ else if (methodComposite != null) {
+ actionAnnotation = methodComposite.getActionAnnot();
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("Unable to get Action annotation.");
+ }
+ }
+ }
+ return actionAnnotation;
}
// ===========================================
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org