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 sc...@apache.org on 2007/02/18 15:42:56 UTC
svn commit: r508905 - in /webservices/axis2/trunk/java/modules:
jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/
jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/
jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ metad...
Author: scheu
Date: Sun Feb 18 06:42:55 2007
New Revision: 508905
URL: http://svn.apache.org/viewvc?view=rev&rev=508905
Log:
AXIS2-2209
Contributor:Rich Scheuerle
Move @RequestWrapper and @ResponseWrapper classname defaulting from metadata module to the jaxws module
Added:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.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/impl/EndpointInterfaceDescriptionImpl.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java Sun Feb 18 06:42:55 2007
@@ -335,7 +335,8 @@
}
// Now create the single JAXB element
- Class cls = MethodMarshallerUtils.loadClass(operationDesc.getResponseWrapperClassName());
+ String wrapperName = marshalDesc.getResponseWrapperClassName(operationDesc);
+ Class cls = MethodMarshallerUtils.loadClass(wrapperName);
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -422,7 +423,8 @@
}
// Now create the single JAXB element
- Class cls = MethodMarshallerUtils.loadClass(operationDesc.getRequestWrapperClassName());
+ String wrapperName = marshalDesc.getRequestWrapperClassName(operationDesc);
+ Class cls = MethodMarshallerUtils.loadClass(wrapperName);
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java Sun Feb 18 06:42:55 2007
@@ -464,7 +464,8 @@
}
// Now create the single JAXB element
- Class cls = MethodMarshallerUtils.loadClass(operationDesc.getResponseWrapperClassName());
+ String wrapperName = marshalDesc.getResponseWrapperClassName(operationDesc);
+ Class cls = MethodMarshallerUtils.loadClass(wrapperName);
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
@@ -569,7 +570,8 @@
}
// Now create the single JAXB element
- Class cls = MethodMarshallerUtils.loadClass(operationDesc.getRequestWrapperClassName());
+ String wrapperName = marshalDesc.getRequestWrapperClassName(operationDesc);
+ Class cls = MethodMarshallerUtils.loadClass(wrapperName);
JAXBWrapperTool wrapperTool = new JAXBWrapperToolImpl();
Object object = wrapperTool.wrap(cls, nameList, objectList,
marshalDesc.getPropertyDescriptorMap(cls));
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/MarshalServiceRuntimeDescription.java Sun Feb 18 06:42:55 2007
@@ -19,6 +19,7 @@
import java.util.Map;
import java.util.TreeSet;
+import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.ServiceRuntimeDescription;
import org.apache.axis2.jaxws.utility.PropertyDescriptorPlus;
@@ -51,4 +52,17 @@
* @return get the cached copy or create a new one
*/
public Map<String, PropertyDescriptorPlus> getPropertyDescriptorMap(Class cls);
+
+ /**
+ * @param operationDesc
+ * @return specified or defaulted wrapper class name. Always returns null if the wrapper class does not exist.
+ */
+ public String getRequestWrapperClassName(OperationDescription operationDesc);
+
+ /**
+ * @param operationDesc
+ * @return specified or defaulted wrapper class name. Always returns null if the wrapper class does not exist.
+ */
+ public String getResponseWrapperClassName(OperationDescription operationDesc);
+
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationBuilder.java Sun Feb 18 06:42:55 2007
@@ -73,16 +73,18 @@
/**
* @param serviceDescription ServiceDescription
+ * @param ap ArtifactProcessor which found/produced artifact classes
* @return AnnotationDesc Map
*/
- public static Map<String, AnnotationDesc> getAnnotationDescs(ServiceDescription serviceDesc) {
+ public static Map<String, AnnotationDesc> getAnnotationDescs(ServiceDescription serviceDesc,
+ ArtifactProcessor ap) {
Map<String, AnnotationDesc> map = new HashMap<String, AnnotationDesc>();
EndpointDescription[] endpointDescs = serviceDesc.getEndpointDescriptions();
// Build a set of packages from all of the endpoints
if (endpointDescs != null) {
for (int i=0; i< endpointDescs.length; i++) {
- getAnnotationDescs(endpointDescs[i], map);
+ getAnnotationDescs(endpointDescs[i], ap, map);
}
}
return map;
@@ -91,28 +93,34 @@
/**
* @param endpointDesc
+ * @param ap ArtifactProcessor which found/produced artifact classes
* @param map
*/
- private static void getAnnotationDescs(EndpointDescription endpointDesc, Map<String, AnnotationDesc> map) {
+ private static void getAnnotationDescs(EndpointDescription endpointDesc,
+ ArtifactProcessor ap, Map<String,
+ AnnotationDesc> map) {
EndpointInterfaceDescription endpointInterfaceDesc =
endpointDesc.getEndpointInterfaceDescription();
if (endpointInterfaceDesc != null) {
- getAnnotationDescs(endpointInterfaceDesc, map);
+ getAnnotationDescs(endpointInterfaceDesc, ap, map);
}
}
/**
* @param endpointInterfaceDesc
+ * @param ap ArtifactProcessor which found/produced artifact classes
* @param map
*/
- private static void getAnnotationDescs(EndpointInterfaceDescription endpointInterfaceDesc, Map<String, AnnotationDesc> map) {
+ private static void getAnnotationDescs(EndpointInterfaceDescription endpointInterfaceDesc,
+ ArtifactProcessor ap,
+ Map<String, AnnotationDesc> map) {
OperationDescription[] opDescs = endpointInterfaceDesc.getOperations();
// Build a set of packages from all of the opertions
if (opDescs != null) {
for (int i=0; i< opDescs.length; i++) {
- getAnnotationDescs(opDescs[i], map);
+ getAnnotationDescs(opDescs[i], ap, map);
}
}
}
@@ -122,9 +130,12 @@
/**
* Get annotations for this operation
* @param opDesc
+ * @param ap ArtifactProcessor which found/produced artifact classes
* @param map
*/
- private static void getAnnotationDescs(OperationDescription opDesc, Map<String, AnnotationDesc> map) {
+ private static void getAnnotationDescs(OperationDescription opDesc,
+ ArtifactProcessor ap,
+ Map<String, AnnotationDesc> map) {
// Walk the parameter information
ParameterDescription[] parameterDescs = opDesc.getParameterDescriptions();
@@ -143,8 +154,14 @@
}
// Also consider the request and response wrappers
- addAnnotation(opDesc.getRequestWrapperClassName(), map);
- addAnnotation(opDesc.getResponseWrapperClassName(), map);
+ String wrapperName = ap.getRequestWrapperMap().get(opDesc);
+ if (wrapperName != null) {
+ addAnnotation(wrapperName, map);
+ }
+ wrapperName = ap.getResponseWrapperMap().get(opDesc);
+ if (wrapperName != null) {
+ addAnnotation(wrapperName, map);
+ }
// Finally consider the result type
@@ -155,7 +172,8 @@
}
- private static void getAnnotationDescs(ParameterDescription paramDesc, Map<String, AnnotationDesc> map) {
+ private static void getAnnotationDescs(ParameterDescription paramDesc,
+ Map<String, AnnotationDesc> map) {
// Get the type that defines the actual data. (this is never a holder )
Class paramClass = paramDesc.getParameterActualType();
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?view=auto&rev=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Sun Feb 18 06:42:55 2007
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * Licensed 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.runtime.description.marshal.impl;
+
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.OperationDescription;
+import org.apache.axis2.jaxws.description.ServiceDescription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Examines a ServiceDesc and locates and/or builds the
+ * JAX-WS artifacts.
+ * The JAX-WS artifacts are:
+ * - request wrapper classes
+ * - response wrapper classes
+ * - fault beans for non-JAX-WS compliant exceptions
+ */
+class ArtifactProcessor {
+
+ private static final Log log = LogFactory.getLog(ArtifactProcessor.class);
+
+ private ServiceDescription serviceDesc;
+ private Map<OperationDescription, String> requestWrapperMap = new HashMap<OperationDescription, String> ();
+ private Map<OperationDescription, String> responseWrapperMap = new HashMap<OperationDescription, String> ();
+
+ /**
+ * Artifact Processor
+ * @param serviceDesc
+ */
+ ArtifactProcessor(ServiceDescription serviceDesc) {
+ this.serviceDesc = serviceDesc;
+ }
+
+ Map<OperationDescription, String> getRequestWrapperMap() {
+ return requestWrapperMap;
+ }
+
+ Map<OperationDescription, String> getResponseWrapperMap() {
+ return responseWrapperMap;
+ }
+
+ void build() {
+ for (EndpointDescription ed:serviceDesc.getEndpointDescriptions()) {
+ if (ed.getEndpointInterfaceDescription() != null) {
+ for (OperationDescription opDesc:ed.getEndpointInterfaceDescription().getOperations()) {
+
+ String declaringClassName = opDesc.getJavaDeclaringClassName();
+ String packageName = getPackageName(declaringClassName);
+ String simpleName = getSimpleClassName(declaringClassName);
+ String methodName = opDesc.getJavaMethodName();
+
+ // There is no default for @RequestWrapper/@ResponseWrapper classname None is listed in Sec. 7.3 on p. 80 of
+ // the JAX-WS spec, BUT Conformance(Using javax.xml.ws.RequestWrapper) in Sec 2.3.1.2 on p. 13
+ // says the entire annotation "...MAY be omitted if all its properties would have default vaules."
+ // We will assume that this statement gives us the liberty to find a wrapper class/build a wrapper class or
+ // implement an engine w/o the wrapper class.
+
+ // @RequestWrapper className processing
+ String requestWrapperName = opDesc.getRequestWrapperClassName();
+ if (requestWrapperName == null) {
+ if (packageName.length() > 0) {
+ requestWrapperName = packageName + "." + javaMethodToClassName(methodName);
+ } else {
+ requestWrapperName = javaMethodToClassName(methodName);
+ }
+ }
+ String foundRequestWrapperName = findArtifact(requestWrapperName);
+ if (foundRequestWrapperName == null) {
+ foundRequestWrapperName = missingArtifact(requestWrapperName);
+ }
+ if (foundRequestWrapperName != null) {
+ requestWrapperMap.put(opDesc, foundRequestWrapperName);
+ }
+
+ // @ResponseWrapper className processing
+ String responseWrapperName = opDesc.getResponseWrapperClassName();
+ if (responseWrapperName == null) {
+ if (packageName.length() > 0) {
+ responseWrapperName = packageName + "." + javaMethodToClassName(methodName) + "Response";
+ } else {
+ responseWrapperName = javaMethodToClassName(methodName) + "Response";
+ }
+ }
+ String foundResponseWrapperName = findArtifact(responseWrapperName);
+ if (foundResponseWrapperName == null) {
+ foundResponseWrapperName = missingArtifact(responseWrapperName);
+ }
+ if (foundResponseWrapperName != null) {
+ responseWrapperMap.put(opDesc, foundResponseWrapperName);
+ }
+
+
+ }
+ }
+ }
+ }
+
+ /**
+ * @param className
+ * @return package name
+ */
+ private static String getPackageName(String className) {
+ int index = className.lastIndexOf(".");
+ if (index == 0) {
+ return "";
+ } else {
+ return className.substring(0,index);
+ }
+ }
+
+ /**
+ * @param className
+ * @return simple class name
+ */
+ private static String getSimpleClassName(String className) {
+ int index = className.lastIndexOf(".");
+ if (index == 0) {
+ return className;
+ } else {
+ return className.substring(index+1);
+ }
+ }
+
+ /**
+ * @param methodName
+ * @return method name converted into a class name
+ */
+ private static String javaMethodToClassName(String methodName) {
+ String className = null;
+ if(methodName != null){
+ StringBuffer buildClassName = new StringBuffer(methodName);
+ buildClassName.replace(0, 1, methodName.substring(0,1).toUpperCase());
+ className = buildClassName.toString();
+ }
+ return className;
+ }
+
+ /**
+ * This method is invoked if the artifact is missing
+ * @param artifactName
+ * @return newly constructed name or null
+ */
+ private String missingArtifact(String artifactName) {
+
+ // TODO Could we contstruct a proxy of the artifact at this point ?
+ if (log.isDebugEnabled()) {
+ log.debug("The following class is missing: " + artifactName +" Processing continues.");
+ }
+ return null;
+ }
+
+ /**
+ * Determine the actual packager name for the generated artifacts by trying to load the class from one of two
+ * packages. This is necessary because the RI implementations of WSGen and WSImport generate the artifacts
+ * in different packages:
+ * - WSImport generates the artifacts in the same package as the SEI
+ * - WSGen generates the artifacts in a "jaxws" sub package under the SEI package.
+ * Note that from reading the JAX-WS spec, it seems that WSGen is doing that correctly; See
+ * the conformance requirement in JAX-WS 2.0 Spec Section 3.6.2.1 Document Wrapped on page 36:
+ * Conformance (Default wrapper bean package): In the absence of customizations, the wrapper beans package
+ * MUST be a generated jaxws subpackage of the SEI package.
+ * ^^^^^^^^^^^^^^^^
+ * @param artifactClassName
+ * @return
+ */
+ static final String JAXWS_SUBPACKAGE = "jaxws";
+ private static String findArtifact(String artifactClassName) {
+ String returnArtifactClassName = null;
+ if (artifactClassName == null) {
+ return returnArtifactClassName;
+ }
+
+ // Try to load the class that was passed in
+ try {
+ loadClass(artifactClassName);
+ returnArtifactClassName = artifactClassName;
+ }
+ catch (ClassNotFoundException e) {
+ // Couldn't load the class; we'll try another one below.
+ }
+
+ // If the original class couldn't be loaded, try adding ".jaxws." to the package
+ if (returnArtifactClassName == null) {
+ String originalPackage = getPackageName(artifactClassName);
+ if (originalPackage.length() > 0) {
+ String alternatePackage = originalPackage + "." + JAXWS_SUBPACKAGE;
+ String className = getSimpleClassName(artifactClassName);
+ String alternateWrapperClass = alternatePackage + "." + className;
+ try {
+ loadClass(alternateWrapperClass);
+ returnArtifactClassName = alternateWrapperClass;
+ }
+ catch (ClassNotFoundException e) {
+ // Couldn't load the class
+ }
+ }
+ }
+
+ return returnArtifactClassName;
+ }
+
+ private static Class loadClass(String className)throws ClassNotFoundException {
+ // Don't make this public, its a security exposure
+ return forName(className, true, getContextClassLoader());
+ }
+
+ /**
+ * Return the class for this name
+ * @return Class
+ */
+ private static Class forName(final String className, final boolean initialize, final ClassLoader classloader) throws ClassNotFoundException {
+ // NOTE: This method must remain protected because it uses AccessController
+ Class cl = null;
+ try {
+ cl = (Class) AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() throws ClassNotFoundException {
+ return Class.forName(className, initialize, classloader);
+ }
+ }
+ );
+ } catch (PrivilegedActionException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Exception thrown from AccessController: " + e);
+ }
+ throw (ClassNotFoundException) e.getException();
+ }
+
+ return cl;
+ }
+
+ /**
+ * @return ClassLoader
+ */
+ private static ClassLoader getContextClassLoader() {
+ // NOTE: This method must remain private because it uses AccessController
+ ClassLoader cl = null;
+ try {
+ cl = (ClassLoader) AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() throws ClassNotFoundException {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ }
+ );
+ } catch (PrivilegedActionException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Exception thrown from AccessController: " + e);
+ }
+ throw (RuntimeException) e.getException();
+ }
+
+ return cl;
+ }
+}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionBuilder.java Sun Feb 18 06:42:55 2007
@@ -24,11 +24,13 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
import java.util.TreeSet;
import javax.annotation.Resource;
import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
@@ -37,6 +39,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import com.ibm.org.omg.CORBA.OperationDescription;
+
public class MarshalServiceRuntimeDescriptionBuilder {
private static Log log = LogFactory.getLog(MarshalServiceRuntimeDescriptionBuilder.class);
@@ -69,10 +73,20 @@
static private void init(MarshalServiceRuntimeDescriptionImpl marshalDesc,
ServiceDescription serviceDesc) {
- // Build the annotation map first
+ // Artifact class discovery/builder
+ ArtifactProcessor artifactProcessor = new ArtifactProcessor(serviceDesc);
+ try {
+ artifactProcessor.build();
+ } catch (Throwable t) {
+ ExceptionFactory.makeWebServiceException(t);
+ }
+ marshalDesc.setRequestWrapperMap(artifactProcessor.getRequestWrapperMap());
+ marshalDesc.setResponseWrapperMap(artifactProcessor.getResponseWrapperMap());
+
+ // Build the annotation map
Map<String, AnnotationDesc> map;
try {
- map = AnnotationBuilder.getAnnotationDescs(serviceDesc);
+ map = AnnotationBuilder.getAnnotationDescs(serviceDesc, artifactProcessor);
} catch(Throwable t) {
// Since we are building a cache, proceed without exception
if (log.isDebugEnabled()) {
@@ -83,10 +97,9 @@
marshalDesc.setAnnotationMap(map);
// Build the property descriptor map
- // TODO nothing is cached right now
Map<Class, Map<String, PropertyDescriptorPlus>> cache;
try {
- cache = PropertyDescriptorMapBuilder.getPropertyDescMaps(serviceDesc);
+ cache = PropertyDescriptorMapBuilder.getPropertyDescMaps(serviceDesc,artifactProcessor);
} catch (Throwable t) {
// Since we are building a cache, proceed without exception
if (log.isDebugEnabled()) {
@@ -112,7 +125,7 @@
}
if (doAnnotationWalk) {
// Get the package names from the annotations. Use the annotation map to reduce Annotation introspection
- packages.addAll(PackageSetBuilder.getPackagesFromAnnotations(serviceDesc, map));
+ packages.addAll(PackageSetBuilder.getPackagesFromAnnotations(serviceDesc, marshalDesc));
}
marshalDesc.setPackages(packages);
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/MarshalServiceRuntimeDescriptionImpl.java Sun Feb 18 06:42:55 2007
@@ -1,12 +1,11 @@
package org.apache.axis2.jaxws.runtime.description.marshal.impl;
-import java.beans.PropertyDescriptor;
-import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;
import java.util.Map.Entry;
import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.description.OperationDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
@@ -22,6 +21,8 @@
private TreeSet<String> packages;
private Map<String, AnnotationDesc> annotationMap = null;
private Map<Class, Map<String, PropertyDescriptorPlus>> pdMapCache = null;
+ private Map<OperationDescription, String> requestWrapperMap = null;
+ private Map<OperationDescription, String> responseWrapperMap = null;
protected MarshalServiceRuntimeDescriptionImpl(String key,
ServiceDescription serviceDesc) {
@@ -87,6 +88,22 @@
this.pdMapCache = cache;
}
+ public String getRequestWrapperClassName(OperationDescription operationDesc) {
+ return requestWrapperMap.get(operationDesc);
+ }
+
+ void setRequestWrapperMap(Map<OperationDescription, String> map) {
+ requestWrapperMap = map;
+ }
+
+ public String getResponseWrapperClassName(OperationDescription operationDesc) {
+ return responseWrapperMap.get(operationDesc);
+ }
+
+ void setResponseWrapperMap(Map<OperationDescription, String> map) {
+ responseWrapperMap = map;
+ }
+
public String toString() {
final String newline = "\n";
StringBuffer string = new StringBuffer();
@@ -117,4 +134,5 @@
return string.toString();
}
+
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java Sun Feb 18 06:42:55 2007
@@ -42,6 +42,7 @@
import org.apache.axis2.jaxws.description.ServiceDescription;
import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
import org.apache.axis2.jaxws.runtime.description.marshal.AnnotationDesc;
+import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.axis2.jaxws.util.WSDLWrapper;
import org.apache.axis2.jaxws.utility.JavaUtils;
@@ -132,14 +133,14 @@
* @param serviceDescription ServiceDescription
* @return Set of Packages
*/
- public static TreeSet<String> getPackagesFromAnnotations(ServiceDescription serviceDesc, Map<String, AnnotationDesc> annotationMap) {
+ public static TreeSet<String> getPackagesFromAnnotations(ServiceDescription serviceDesc, MarshalServiceRuntimeDescription msrd) {
TreeSet<String> set = new TreeSet<String>();
EndpointDescription[] endpointDescs = serviceDesc.getEndpointDescriptions();
// Build a set of packages from all of the endpoints
if (endpointDescs != null) {
for (int i=0; i< endpointDescs.length; i++) {
- set.addAll(getPackagesFromAnnotations(endpointDescs[i], annotationMap));
+ set.addAll(getPackagesFromAnnotations(endpointDescs[i], msrd));
}
}
return set;
@@ -150,13 +151,13 @@
* @return Set of Packages
*/
private static TreeSet<String> getPackagesFromAnnotations(EndpointDescription endpointDesc,
- Map<String, AnnotationDesc> annotationMap) {
+ MarshalServiceRuntimeDescription msrd) {
EndpointInterfaceDescription endpointInterfaceDesc =
endpointDesc.getEndpointInterfaceDescription();
if (endpointInterfaceDesc == null) {
return new TreeSet<String>();
} else {
- return getPackagesFromAnnotations(endpointInterfaceDesc, annotationMap);
+ return getPackagesFromAnnotations(endpointInterfaceDesc, msrd);
}
}
@@ -165,14 +166,14 @@
* @return Set of Packages
*/
private static TreeSet<String> getPackagesFromAnnotations(EndpointInterfaceDescription endpointInterfaceDesc,
- Map<String, AnnotationDesc> annotationMap) {
+ MarshalServiceRuntimeDescription msrd) {
TreeSet<String> set = new TreeSet<String>();
OperationDescription[] opDescs = endpointInterfaceDesc.getOperations();
// Build a set of packages from all of the opertions
if (opDescs != null) {
for (int i=0; i< opDescs.length; i++) {
- getPackagesFromAnnotations(opDescs[i], set, annotationMap);
+ getPackagesFromAnnotations(opDescs[i], set, msrd);
}
}
return set;
@@ -184,13 +185,13 @@
* @param set Set<Package> that is updated
*/
private static void getPackagesFromAnnotations(OperationDescription opDesc, TreeSet<String> set,
- Map<String, AnnotationDesc> annotationMap) {
+ MarshalServiceRuntimeDescription msrd) {
// Walk the parameter information
ParameterDescription[] parameterDescs = opDesc.getParameterDescriptions();
if (parameterDescs != null) {
for (int i=0; i <parameterDescs.length; i++) {
- getPackagesFromAnnotations(parameterDescs[i], set, annotationMap);
+ getPackagesFromAnnotations(parameterDescs[i], set, msrd);
}
}
@@ -198,19 +199,19 @@
FaultDescription[] faultDescs = opDesc.getFaultDescriptions();
if (faultDescs != null) {
for (int i=0; i <faultDescs.length; i++) {
- getPackagesFromAnnotations(faultDescs[i], set, annotationMap);
+ getPackagesFromAnnotations(faultDescs[i], set, msrd);
}
}
// Also consider the request and response wrappers
- String pkg = getPackageFromClassName(opDesc.getRequestWrapperClassName());
+ String pkg = getPackageFromClassName(msrd.getRequestWrapperClassName(opDesc));
if(log.isDebugEnabled()){
log.debug("Package from Request Wrapper annotation = "+ pkg);
}
if (pkg != null) {
set.add(pkg);
}
- pkg = getPackageFromClassName(opDesc.getResponseWrapperClassName());
+ pkg = getPackageFromClassName(msrd.getResponseWrapperClassName(opDesc));
if(log.isDebugEnabled()){
log.debug("Package from Response Wrapper annotation = "+ pkg);
}
@@ -238,13 +239,13 @@
* @param set Set<Package> that is updated
*/
private static void getPackagesFromAnnotations(ParameterDescription paramDesc, TreeSet<String> set,
- Map<String, AnnotationDesc> annotationMap) {
+ MarshalServiceRuntimeDescription msrd) {
// Get the type that defines the actual data. (this is never a holder )
Class paramClass = paramDesc.getParameterActualType();
if (paramClass != null) {
- setTypeAndElementPackages(paramClass, paramDesc.getTargetNamespace(), paramDesc.getPartName(), set, annotationMap);
+ setTypeAndElementPackages(paramClass, paramDesc.getTargetNamespace(), paramDesc.getPartName(), set, msrd);
}
}
@@ -255,11 +256,11 @@
* @param set Set<Package> that is updated
*/
private static void getPackagesFromAnnotations(FaultDescription faultDesc, TreeSet<String> set,
- Map<String, AnnotationDesc> annotationMap) {
+ MarshalServiceRuntimeDescription msrd) {
Class faultBean = loadClass(faultDesc.getFaultBean());
if (faultBean != null) {
- setTypeAndElementPackages(faultBean, faultDesc.getTargetNamespace(), faultDesc.getName(), set, annotationMap);
+ setTypeAndElementPackages(faultBean, faultDesc.getTargetNamespace(), faultDesc.getName(), set, msrd);
}
}
@@ -271,10 +272,10 @@
* @param set with both type and element packages set
*/
private static void setTypeAndElementPackages(Class cls, String namespace, String localPart, TreeSet<String> set,
- Map<String, AnnotationDesc> annotationMap) {
+ MarshalServiceRuntimeDescription msrd) {
// Get the element and type classes
- Class eClass = getElement(cls, annotationMap);
+ Class eClass = getElement(cls, msrd);
Class tClass = getType(cls);
// Set the package for the type
@@ -317,8 +318,8 @@
* @param cls Class
* @return Class or null
*/
- private static Class getElement(Class cls, Map<String, AnnotationDesc> annotationMap) {
- AnnotationDesc annotationDesc = annotationMap.get(cls.getCanonicalName());
+ private static Class getElement(Class cls, MarshalServiceRuntimeDescription msrd) {
+ AnnotationDesc annotationDesc = msrd.getAnnotationDesc(cls);
if (annotationDesc == null) {
// This shouldn't happen
annotationDesc = AnnotationDescImpl.create(cls);
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PropertyDescriptorMapBuilder.java Sun Feb 18 06:42:55 2007
@@ -74,16 +74,19 @@
/**
* @param serviceDescription ServiceDescription
+ * @param ap ArtifactProcessor which found the artifact classes
* @return PropertyDescriptor Map
*/
- public static Map<Class,Map<String, PropertyDescriptorPlus>> getPropertyDescMaps(ServiceDescription serviceDesc) {
+ public static Map<Class,Map<String, PropertyDescriptorPlus>> getPropertyDescMaps(
+ ServiceDescription serviceDesc,
+ ArtifactProcessor ap) {
Map<Class,Map<String, PropertyDescriptorPlus>> map = new HashMap<Class,Map<String, PropertyDescriptorPlus>>();
EndpointDescription[] endpointDescs = serviceDesc.getEndpointDescriptions();
// Build a set of packages from all of the endpoints
if (endpointDescs != null) {
for (int i=0; i< endpointDescs.length; i++) {
- getPropertyDescMaps(endpointDescs[i], map);
+ getPropertyDescMaps(endpointDescs[i], ap, map);
}
}
return map;
@@ -92,28 +95,34 @@
/**
* @param endpointDesc
+ * @param ap ArtifactProcessor which found the artifact classes
* @param map
*/
- private static void getPropertyDescMaps(EndpointDescription endpointDesc, Map<Class,Map<String, PropertyDescriptorPlus>> map) {
+ private static void getPropertyDescMaps(EndpointDescription endpointDesc,
+ ArtifactProcessor ap,
+ Map<Class,Map<String, PropertyDescriptorPlus>> map) {
EndpointInterfaceDescription endpointInterfaceDesc =
endpointDesc.getEndpointInterfaceDescription();
if (endpointInterfaceDesc != null) {
- getPropertyDescMaps(endpointInterfaceDesc, map);
+ getPropertyDescMaps(endpointInterfaceDesc, ap, map);
}
}
/**
* @param endpointInterfaceDesc
+ * @param ap ArtifactProcessor which found the artifact classes
* @param map
*/
- private static void getPropertyDescMaps(EndpointInterfaceDescription endpointInterfaceDesc, Map<Class,Map<String, PropertyDescriptorPlus>> map) {
+ private static void getPropertyDescMaps(EndpointInterfaceDescription endpointInterfaceDesc,
+ ArtifactProcessor ap,
+ Map<Class,Map<String, PropertyDescriptorPlus>> map) {
OperationDescription[] opDescs = endpointInterfaceDesc.getOperations();
// Build a set of packages from all of the opertions
if (opDescs != null) {
for (int i=0; i< opDescs.length; i++) {
- getPropertyDescMaps(opDescs[i], map);
+ getPropertyDescMaps(opDescs[i], ap, map);
}
}
}
@@ -124,7 +133,9 @@
* @param opDesc
* @param map
*/
- private static void getPropertyDescMaps(OperationDescription opDesc, Map<Class,Map<String, PropertyDescriptorPlus>> map) {
+ private static void getPropertyDescMaps(OperationDescription opDesc,
+ ArtifactProcessor ap,
+ Map<Class,Map<String, PropertyDescriptorPlus>> map) {
// Walk the fault information
@@ -136,10 +147,14 @@
}
// Also consider the request and response wrappers
- addPropertyDesc(opDesc.getRequestWrapperClassName(), map);
- addPropertyDesc(opDesc.getResponseWrapperClassName(), map);
-
-
+ String wrapperName = ap.getRequestWrapperMap().get(opDesc);
+ if (wrapperName != null) {
+ addPropertyDesc(wrapperName, map);
+ }
+ wrapperName = ap.getResponseWrapperMap().get(opDesc);
+ if (wrapperName != null) {
+ addPropertyDesc(wrapperName, map);
+ }
}
/**
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/OperationDescription.java Sun Feb 18 06:42:55 2007
@@ -67,6 +67,7 @@
public abstract AxisOperation getAxisOperation();
public String getJavaMethodName();
+ public String getJavaDeclaringClassName();
public String[] getJavaParameters();
// TODO: Fix up the difference between getSEIMethod and getMethodFromServiceImpl when java reflection is removed.
/**
@@ -130,10 +131,24 @@
*/
public Class getResultActualType();
+ /**
+ * @return the class name of the wrapper class.
+ * NOTE: This method will return null if the request wrapper class is not known during the description layer processing.
+ * In such cases the implementation may use proprietary code to find the class.
+ * For example, JAXWS may look for a matching class in the sei package, in a special jaxws package or
+ * proceed without the class name
+ */
public String getRequestWrapperClassName();
public String getRequestWrapperTargetNamespace();
public String getRequestWrapperLocalName();
+ /**
+ * @return the class name of the wrapper class.
+ * NOTE: This method will return null if the request wrapper class is not known during the description layer processing.
+ * In such cases the implementation may use proprietary code to find the class.
+ * For example, JAXWS may look for a matching class in the sei package, in a special jaxws package or
+ * proceed without the class name
+ */
public String getResponseWrapperClassName();
public String getResponseWrapperTargetNamespace();
public String getResponseWrapperLocalName();
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?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- 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 Sun Feb 18 06:42:55 2007
@@ -36,11 +36,19 @@
public String getAnnoWebResultTargetNamespace();
public RequestWrapper getAnnoRequestWrapper();
+ /**
+ * @return the specified value of @RequestWrapper className or null
+ * NOTE: There is no default for the classname
+ */
public String getAnnoRequestWrapperClassName();
public String getAnnoRequestWrapperLocalName();
public String getAnnoRequestWrapperTargetNamespace();
public ResponseWrapper getAnnoResponseWrapper();
+ /**
+ * @return the specified value of @ResponseWrapper className or null
+ * NOTE: There is no default for the classname
+ */
public String getAnnoResponseWrapperClassName();
public String getAnnoResponseWrapperLocalName();
public String getAnnoResponseWrapperTargetNamespace();
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/EndpointInterfaceDescriptionImpl.java Sun Feb 18 06:42:55 2007
@@ -136,8 +136,6 @@
parentEndpointDescription = parent;
this.dbc = dbc;
-// BasicConfigurator.configure();
-
//TODO: yikes! ...too much redirection, consider setting this in higher level
getEndpointDescription().getAxisService().setTargetNamespace(getEndpointDescriptionImpl().getTargetNamespace());
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?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- 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 Sun Feb 18 06:42:55 2007
@@ -300,6 +300,16 @@
return returnString;
}
+ public String getJavaDeclaringClassName() {
+ if (!isDBC() && seiMethod != null) {
+ Class clazz = seiMethod.getDeclaringClass();
+ return clazz.getCanonicalName();
+ } else if (methodComposite != null) {
+ return methodComposite.getDeclaringClass();
+ }
+ return null;
+ }
+
public String[] getJavaParameters() {
ArrayList<String> returnParameters = new ArrayList<String>();
@@ -661,26 +671,10 @@
requestWrapperClassName = getAnnoRequestWrapper().className();
}
else {
- // Not sure what the default value should be (if any). None is listed in Sec. 7.3 on p. 80 of
- // the JAX-WS spec, BUT Conformance(Using javax.xml.ws.RequestWrapper) in Sec 2.3.1.2 on p. 13
- // says the entire annotation "...MAY be omitted if all its properties would have default vaules."
- // implying there IS some sort of default. We'll try this for now:
- if (isDBC() && methodComposite != null) {
- String declaringClazz = this.methodComposite.getDeclaringClass();
- String packageName = declaringClazz.substring(0, declaringClazz.lastIndexOf("."));
- requestWrapperClassName = packageName + "." + DescriptionUtils.javaMethodtoClassName(methodComposite.getMethodName());
-
- } else if (!isDBC() && seiMethod != null) {
- Class clazz = seiMethod.getDeclaringClass();
- String packageName = clazz.getPackage().getName();
- String className = DescriptionUtils.javaMethodtoClassName(seiMethod.getName());
- requestWrapperClassName = packageName + "." + className;
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Unable to get RequestWrapper classname");
- }
- }
- requestWrapperClassName = DescriptionUtils.determineActualAritfactPackage(requestWrapperClassName);
+ // There is no default for the RequestWrapper class name.
+ // In such cases the programming layer (JAXWS) may use a programming spec specific
+ // mechanism to find the class, build the class, or operate without the class.
+ requestWrapperClassName = null;
}
}
return requestWrapperClassName;
@@ -775,28 +769,10 @@
responseWrapperClassName = getAnnoResponseWrapper().className();
}
else {
- // Not sure what the default value should be (if any). None is listed in Sec. 7.4 on p. 81 of
- // the JAX-WS spec, BUT Conformance(Using javax.xml.ws.ResponseWrapper) in Sec 2.3.1.2 on p. 13
- // says the entire annotation "...MAY be omitted if all its properties would have default vaules."
- // implying there IS some sort of default. We'll try this for now:
- if (!isDBC() && seiMethod != null) {
- Class clazz = seiMethod.getDeclaringClass();
- String packageName = clazz.getPackage().getName();
- String className = DescriptionUtils.javaMethodtoClassName(seiMethod.getName());
- responseWrapperClassName = packageName + "." + className + "Response";
- } else if (methodComposite != null) {
- //JAXWS Spec is not clear on what default should be added. We think its the endpoint impls package + OperationName + Response.
- //In situation where wsGen uses sei's package to store jaxb bean.
- String declaringClazz = methodComposite.getDeclaringClass();
- String packageName = declaringClazz.substring(0, declaringClazz.lastIndexOf("."));
- responseWrapperClassName = packageName + "." + DescriptionUtils.javaMethodtoClassName(methodComposite.getMethodName()) + "Response";
- }
- else {
- if (log.isDebugEnabled()) {
- log.debug("Unable to get ResponseWrapper annotation class name");
- }
- }
- responseWrapperClassName = DescriptionUtils.determineActualAritfactPackage(responseWrapperClassName);
+ // There is no default for the ResponseWrapper class name.
+ // In such cases the programming layer (JAXWS) may use a programming spec specific
+ // mechanism to find the class, build the class, or operate without the class.
+ responseWrapperClassName = null;
}
}
return responseWrapperClassName;
Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java?view=diff&rev=508905&r1=508904&r2=508905
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/WrapperPackageTests.java Sun Feb 18 06:42:55 2007
@@ -26,10 +26,7 @@
import junit.framework.TestCase;
/**
- * Tests the request and response wrappers based on the different values used by
- * WSGen and WSImport; WSGen generates artifacts in the "jaxws" package below the
- * SEI package (which seems to be correct per JAX-WS 2.0 Spec Section 3.6.2.1) while
- * WSImport generates them in the same package of the SEI.
+ * Tests the request and response wrappers.
*/
public class WrapperPackageTests extends TestCase {
@@ -37,9 +34,18 @@
EndpointInterfaceDescription eiDesc = getEndpointInterfaceDesc(SEIPackageWrapper.class);
OperationDescription opDesc = eiDesc.getOperation("method1");
String requestWrapperClass = opDesc.getRequestWrapperClassName();
- assertEquals("org.apache.axis2.jaxws.description.Method1", requestWrapperClass);
+
+ // The algorithm to find the response wrapper is not defined by the specification.
+ // The marshalling layer (jaxws) can use proprietary mechanisms to find, build or operate
+ // without the wrapper class.
+
+ //assertEquals("org.apache.axis2.jaxws.description.Method1", requestWrapperClass);
+ assertEquals(null, requestWrapperClass);
+
String responseWrapperClass = opDesc.getResponseWrapperClassName();
- assertEquals("org.apache.axis2.jaxws.description.Method1Response", responseWrapperClass);
+ //assertEquals("org.apache.axis2.jaxws.description.Method1Response", responseWrapperClass);
+ assertEquals(null, responseWrapperClass);
+
FaultDescription fDesc = opDesc.getFaultDescriptions()[0];
String faultExceptionClass = fDesc.getExceptionClassName();
assertEquals("org.apache.axis2.jaxws.description.Method1Exception", faultExceptionClass);
@@ -51,10 +57,16 @@
public void testSEISubPackageWrapper() {
EndpointInterfaceDescription eiDesc = getEndpointInterfaceDesc(SEISubPackageWrapper.class);
OperationDescription opDesc = eiDesc.getOperation("subPackageMethod1");
+ // The algorithm to find the response wrapper is not defined by the specification.
+ // The marshalling layer (jaxws) can use proprietary mechanisms to find, build or operate
+ // without the wrapper class.
+
String requestWrapperClass = opDesc.getRequestWrapperClassName();
- assertEquals("org.apache.axis2.jaxws.description.jaxws.SubPackageMethod1", requestWrapperClass);
+ //assertEquals("org.apache.axis2.jaxws.description.jaxws.SubPackageMethod1", requestWrapperClass);
+ assertEquals(null, requestWrapperClass);
String responseWrapperClass = opDesc.getResponseWrapperClassName();
- assertEquals("org.apache.axis2.jaxws.description.jaxws.SubPackageMethod1Response", responseWrapperClass);
+ //assertEquals("org.apache.axis2.jaxws.description.jaxws.SubPackageMethod1Response", responseWrapperClass);
+ assertEquals(null, responseWrapperClass);
FaultDescription fDesc = opDesc.getFaultDescriptions()[0];
String faultExceptionClass = fDesc.getExceptionClassName();
assertEquals("org.apache.axis2.jaxws.description.SubPackageException", faultExceptionClass);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org