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 ga...@apache.org on 2007/07/20 05:35:32 UTC
svn commit: r557860 - in /webservices/axis2/trunk/java/modules:
jaxws/src/org/apache/axis2/jaxws/dispatchers/
metadata/src/org/apache/axis2/jaxws/description/
metadata/src/org/apache/axis2/jaxws/description/impl/
Author: gawor
Date: Thu Jul 19 20:35:29 2007
New Revision: 557860
URL: http://svn.apache.org/viewvc?view=rev&rev=557860
Log:
extended MU checker to consider SOAPHandlers headers and added a function to create a parameter with SOAPHandlers headers (the parameter is not set anywhere now)
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/dispatchers/MustUnderstandUtils.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/dispatchers/MustUnderstandUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/dispatchers/MustUnderstandUtils.java?view=diff&rev=557860&r1=557859&r2=557860
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/dispatchers/MustUnderstandUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/dispatchers/MustUnderstandUtils.java Thu Jul 19 20:35:29 2007
@@ -21,9 +21,11 @@
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -58,7 +60,7 @@
return;
}
- ArrayList understoodHeaderQNames = MustUnderstandUtils.getSEIHeaderParamaterList(msgContext);
+ ArrayList understoodHeaderQNames = MustUnderstandUtils.getHeaderParamaterList(msgContext);
if (understoodHeaderQNames == null) {
return;
}
@@ -80,13 +82,13 @@
/**
* Return an ArrayList of QNames corresponding to SOAP headers which map to method parameters
- * for any methods on the corresponding SEI.
+ * for any methods on the corresponding SEI and the SOAP handlers.
*
* @param msgContext
- * @return ArrayList of QNames for all header parameters for an SEI. The list may be empty but
- * will not be null.
+ * @return ArrayList of QNames for all header parameters for an SEI and SOAP handlers.
+ * The list may be empty but will not be null.
*/
- public static ArrayList getSEIHeaderParamaterList(MessageContext msgContext) {
+ public static ArrayList getHeaderParamaterList(MessageContext msgContext) {
ArrayList returnList = new ArrayList();
// Build a list of understood headers for all the operations under the service
AxisService axisService = msgContext.getAxisService();
@@ -94,11 +96,14 @@
log.debug("Building list of understood headers for all operations under " + axisService);
}
if (axisService != null) {
+ ArrayList understoodHeaders;
+
+ // examine SEI methods
Iterator operationIterator = axisService.getOperations();
if (operationIterator != null) {
while (operationIterator.hasNext()) {
AxisOperation operation = (AxisOperation) operationIterator.next();
- ArrayList understoodHeaders = getSEIMethodHeaderParameterList(operation);
+ understoodHeaders = getSEIMethodHeaderParameterList(operation);
if (log.isDebugEnabled()) {
log.debug("Adding headers from operation " + operation + "; headers = "
+ understoodHeaders);
@@ -108,6 +113,15 @@
}
}
}
+
+ // examine handlers
+ understoodHeaders = getHandlersHeaderParameterList(axisService);
+ if (log.isDebugEnabled()) {
+ log.debug("Adding headers from SOAP handlers; headers = " + understoodHeaders);
+ }
+ if (understoodHeaders != null && !understoodHeaders.isEmpty()) {
+ returnList.addAll(understoodHeaders);
+ }
}
return returnList;
}
@@ -120,12 +134,25 @@
* @return ArrayList of header QNames for all header paramters on an operation, or null if none.
*/
public static ArrayList getSEIMethodHeaderParameterList(AxisOperation axisOperation) {
-
- Parameter headerQNamesParameter = axisOperation.getParameter(OperationDescription.HEADER_PARAMETER_QNAMES);
+ return getHeaderParameterList(axisOperation, OperationDescription.HEADER_PARAMETER_QNAMES);
+ }
+
+ /**
+ * Return an ArrayList of QNames that is a collection of SOAP handlers
+ *
+ * @param axisService
+ * @return ArrayList of header QNames.
+ */
+ public static ArrayList getHandlersHeaderParameterList(AxisService axisService) {
+ return getHeaderParameterList(axisService, EndpointDescription.HANDLER_PARAMETER_QNAMES);
+ }
+
+ private static ArrayList getHeaderParameterList(AxisDescription axisDescription, String paramName) {
+ Parameter headerQNamesParameter = axisDescription.getParameter(paramName);
if (headerQNamesParameter == null) {
if (log.isDebugEnabled()) {
- log.debug("Parameter not on AxisOperation " + axisOperation + "; "
- + OperationDescription.HEADER_PARAMETER_QNAMES);
+ log.debug("Parameter not on " + axisDescription + "; "
+ + paramName);
}
return null;
}
@@ -133,8 +160,8 @@
ArrayList understoodHeaderQNames = (ArrayList) headerQNamesParameter.getValue();
if (understoodHeaderQNames == null || understoodHeaderQNames.isEmpty()) {
if (log.isDebugEnabled()) {
- log.debug("Parameter value on AxisOperation is empty: " + axisOperation + "; "
- + OperationDescription.HEADER_PARAMETER_QNAMES);
+ log.debug("Parameter value is empty: " + axisDescription + "; "
+ + paramName);
}
return null;
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java?view=diff&rev=557860&r1=557859&r2=557860
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/EndpointDescription.java Thu Jul 19 20:35:29 2007
@@ -66,6 +66,12 @@
"org.apache.axis2.jaxws.description.EndpointDescription";
public static final String DEFAULT_CLIENT_BINDING_ID = SOAPBinding.SOAP11HTTP_BINDING;
+ /**
+ * Paramater set on AxisService which contains an ArrayList of SOAP header QNames
+ * of SOAPHandlers.
+ */
+ public static final String HANDLER_PARAMETER_QNAMES = "org.apache.axis2.jaxws.description.EndpointDescription.handlerParameterQNames";
+
public abstract AxisService getAxisService();
public abstract ServiceClient getServiceClient();
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java?view=diff&rev=557860&r1=557859&r2=557860
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/DescriptionUtils.java Thu Jul 19 20:35:29 2007
@@ -20,9 +20,14 @@
import static org.apache.axis2.jaxws.description.builder.MDQConstants.CONSTRUCTOR_METHOD;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
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.EndpointDescription;
+import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.WebMethodAnnot;
@@ -45,6 +50,8 @@
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.soap.SOAPHandler;
import java.io.IOException;
import java.io.InputStream;
@@ -56,6 +63,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.StringTokenizer;
/** Utilities used throughout the Description package. */
@@ -494,5 +502,38 @@
}
}
}
+ }
+
+ public static void registerHandlerHeaders(AxisService axisService, List<Handler> handlers) {
+ if (handlers == null || axisService == null) {
+ return;
+ }
+
+ ArrayList<QName> understoodHeaderQNames = new ArrayList<QName>();
+ for (Handler handler : handlers) {
+ if (handler instanceof SOAPHandler) {
+ SOAPHandler soapHandler = (SOAPHandler) handler;
+
+ Set<QName> headers = soapHandler.getHeaders();
+ if (headers != null) {
+ for (QName header : headers) {
+ if (!understoodHeaderQNames.contains(header)) {
+ understoodHeaderQNames.add(header);
+ }
+ }
+ }
+ }
+ }
+
+ if (!understoodHeaderQNames.isEmpty()) {
+ Parameter headerQNParameter =
+ new Parameter(EndpointDescription.HANDLER_PARAMETER_QNAMES, understoodHeaderQNames);
+ try {
+ axisService.addParameter(headerQNParameter);
+ } catch (AxisFault e) {
+ // TODO: RAS
+ log.warn("Unable to add Parameter for header QNames to AxisService " + axisService, e);
+ }
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org