geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdam...@apache.org
Subject svn commit: r161304 - in geronimo/trunk/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ axis/src/java/org/apache/geronimo/axis/server/ jetty/ jetty/src/java/org/apache/geronimo/jetty/
Date Thu, 14 Apr 2005 15:23:33 GMT
Author: gdamour
Date: Thu Apr 14 08:23:31 2005
New Revision: 161304

URL: http://svn.apache.org/viewcvs?view=rev&rev=161304
Log:
A couple of changes to get document style working, at least for POJO WS.

o update JettyPOJOWebServiceHolder such that it registers during start-up the
TypeDesc of the exposed service. This also includes a new dependency to
geronimo-axis from geronimo-jetty.

o add a TypeDescInfo class wrapping all the information required to recreate
a TypeDesc. As a matter of fact TypeDesc cannot be serialized "as is" due
to the contained property descriptors, which are not serializable. An Axis
patch is required to fix this problem.

o update HeavyweightOperationDescBuilder such that parameters and return
value of document style operations are "correctly" mapped. In the case of
document style operations, the names of the parameters and return values are 
the names of the elements defined by the message part.

o fix AxisServiceBuilder.buildOperations such that the soap:binding style is 
provided as the default style for the nested soap:operation.

o Definition.getTypes() may return null. This is not specified by the API;
yet, I have observed this behavior.

Added:
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/TypeDescInfo.java
Modified:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
    geronimo/trunk/modules/jetty/project.xml
    geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?view=diff&r1=161303&r2=161304
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Thu Apr 14 08:23:31 2005
@@ -19,6 +19,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
@@ -44,6 +45,7 @@
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.xml.namespace.QName;
+import javax.xml.rpc.encoding.TypeMapping;
 import javax.xml.rpc.handler.HandlerInfo;
 
 import net.sf.cglib.core.DefaultGeneratorStrategy;
@@ -152,6 +154,7 @@
         //targetGBean.setAttribute("webServiceContainer", axisWebServiceContainer);
         try {
             targetGBean.setAttribute("webServiceContainer", new StoredObject(axisWebServiceContainer));
// Hack!
+            targetGBean.setAttribute("classToTypeDescInfo", new StoredObject((Serializable)
serviceDesc.getProperty(AxisServiceBuilder.CLASS_TO_TYPE_DESC_INFO))); // Hack!
         } catch (IOException e) {
             throw new DeploymentException("Unable to serialize the AxisWebServiceContainer",
e);
         }

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java?view=diff&r1=161303&r2=161304
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
Thu Apr 14 08:23:31 2005
@@ -60,6 +60,7 @@
 import org.apache.axis.encoding.ser.BeanSerializerFactory;
 import org.apache.geronimo.axis.server.ReadOnlyServiceDesc;
 import org.apache.geronimo.axis.server.ServiceInfo;
+import org.apache.geronimo.axis.server.TypeDescInfo;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.kernel.ClassLoading;
@@ -81,7 +82,8 @@
  * @version $Rev$ $Date$
  */
 public class AxisServiceBuilder {
-
+    public static final String CLASS_TO_TYPE_DESC_INFO = "classToTypeDescInfo";
+    
     public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema";
     public static final QName SCHEMA_QNAME = new QName(XSD_NS, "schema");
 
@@ -105,7 +107,7 @@
         return createServiceInfo(portInfo, classLoader);
     }
 
-    public static JavaServiceDesc createEJBServiceDesc(JarFile jarFile, String ejbName, ClassLoader
classLoader) throws DeploymentException {
+    private static JavaServiceDesc createEJBServiceDesc(JarFile jarFile, String ejbName,
ClassLoader classLoader) throws DeploymentException {
         Map portComponentsMap = null;
         try {
             URL webservicesURL = DeploymentUtil.createJarURL(jarFile, "META-INF/webservices.xml");
@@ -223,18 +225,22 @@
         serviceDesc.setTypeMappingRegistry(tmr);
         serviceDesc.setTypeMapping(typeMapping);
 
+        Map classToTypeDescInfo = new HashMap();
+        
         if (isLightweight) {
-            buildLightweightTypes(schemaTypeKeyToSchemaTypeMap, portInfo, classLoader, typeMapping);
+            buildLightweightTypes(schemaTypeKeyToSchemaTypeMap, portInfo, classLoader, typeMapping,
classToTypeDescInfo);
         } else {
             JavaXmlTypeMappingType[] javaXmlTypeMappings = portInfo.getJavaWsdlMapping().getJavaXmlTypeMappingArray();
-            buildHeavyweightTypes(wrapperElementQNames, javaXmlTypeMappings, classLoader,
schemaTypeKeyToSchemaTypeMap, typeMapping);
+            buildHeavyweightTypes(wrapperElementQNames, javaXmlTypeMappings, classLoader,
schemaTypeKeyToSchemaTypeMap, typeMapping, classToTypeDescInfo);
         }
 
+        serviceDesc.setProperty(CLASS_TO_TYPE_DESC_INFO, classToTypeDescInfo);
+        
         serviceDesc.getOperations();
         return new ReadOnlyServiceDesc(serviceDesc);
     }
 
-    private static void buildHeavyweightTypes(Set wrapperElementQNames, JavaXmlTypeMappingType[]
javaXmlTypeMappings, ClassLoader classLoader, Map schemaTypeKeyToSchemaTypeMap, TypeMapping
typeMapping) throws DeploymentException {
+    private static void buildHeavyweightTypes(Set wrapperElementQNames, JavaXmlTypeMappingType[]
javaXmlTypeMappings, ClassLoader classLoader, Map schemaTypeKeyToSchemaTypeMap, TypeMapping
typeMapping, Map classToTypeDescInfo) throws DeploymentException {
         for (int j = 0; j < javaXmlTypeMappings.length; j++) {
             JavaXmlTypeMappingType javaXmlTypeMapping = javaXmlTypeMappings[j];
 
@@ -292,17 +298,18 @@
                 deserializerFactoryClass = ArrayDeserializerFactory.class;
             }
 
-            TypeDesc typeDesc = TypeDescBuilder.getTypeDescriptor(clazz, typeQName, javaXmlTypeMapping,
schemaType);
+            TypeDescInfo typeDescInfo = TypeDescBuilder.getTypeDescInfo(clazz, typeQName,
javaXmlTypeMapping, schemaType);
+            TypeDesc.registerTypeDescForClass(clazz, typeDescInfo.buildTypeDesc());
+            classToTypeDescInfo.put(clazz, typeDescInfo);
 
             SerializerFactory ser = BaseSerializerFactory.createFactory(serializerFactoryClass,
clazz, typeQName);
             DeserializerFactory deser = BaseDeserializerFactory.createFactory(deserializerFactoryClass,
clazz, typeQName);
 
             typeMapping.register(clazz, typeQName, ser, deser);
-            TypeDesc.registerTypeDescForClass(clazz, typeDesc);
         }
     }
 
-    private static void buildLightweightTypes(Map schemaTypeKeyToSchemaTypeMap, PortInfo
portInfo, ClassLoader classLoader, TypeMapping typeMapping) throws DeploymentException {
+    private static void buildLightweightTypes(Map schemaTypeKeyToSchemaTypeMap, PortInfo
portInfo, ClassLoader classLoader, TypeMapping typeMapping, Map classToTypeDescInfo) throws
DeploymentException {
         for (Iterator iterator = schemaTypeKeyToSchemaTypeMap.entrySet().iterator(); iterator.hasNext();)
{
             Map.Entry entry = (Map.Entry) iterator.next();
             SchemaTypeKey key = (SchemaTypeKey) entry.getKey();
@@ -345,6 +352,10 @@
     private static Set buildOperations(Binding binding, Class serviceEndpointInterface, boolean
lightweight, PortInfo portInfo, Map exceptionMap, Map complexTypeMap, Map elementMap, ClassLoader
classLoader, JavaServiceDesc serviceDesc) throws DeploymentException {
         Set wrappedElementQNames = new HashSet();
 
+        SOAPBinding soapBinding = (SOAPBinding) SchemaInfoBuilder.getExtensibilityElement(SOAPBinding.class,
binding.getExtensibilityElements());
+        String portStyleString = soapBinding.getStyle();
+        Style portStyle = Style.getStyle(portStyleString);
+        
         List bindingOperations = binding.getBindingOperations();
         for (int i = 0; i < bindingOperations.size(); i++) {
             BindingOperation bindingOperation = (BindingOperation) bindingOperations.get(i);
@@ -358,7 +369,7 @@
                 ServiceEndpointMethodMappingType[] methodMappings = portInfo.getServiceEndpointInterfaceMapping().getServiceEndpointMethodMappingArray();
                 ServiceEndpointMethodMappingType methodMapping = WSDescriptorParser.getMethodMappingForOperation(operationName,
methodMappings);
                 JavaXmlTypeMappingType[] javaXmlTypeMappingTypes = portInfo.getJavaWsdlMapping().getJavaXmlTypeMappingArray();
-                operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation,
portInfo.getJavaWsdlMapping(), methodMapping, Style.RPC, exceptionMap, complexTypeMap, elementMap,
javaXmlTypeMappingTypes, classLoader, serviceEndpointInterface);
+                operationDescBuilder = new HeavyweightOperationDescBuilder(bindingOperation,
portInfo.getJavaWsdlMapping(), methodMapping, portStyle, exceptionMap, complexTypeMap, elementMap,
javaXmlTypeMappingTypes, classLoader, serviceEndpointInterface);
                 Set wrappedElementQNamesForOper = ((HeavyweightOperationDescBuilder) operationDescBuilder).getWrapperElementQNames();
                 wrappedElementQNames.addAll(wrappedElementQNamesForOper);
             }
@@ -419,34 +430,36 @@
                 }
                 Types types = definition.getTypes();
                 Map namespaceMap = definition.getNamespaces();
-                List schemaList = types.getExtensibilityElements();
-                for (Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();) {
-                    Object o = iterator1.next();
-                    if (o instanceof Schema) {
-                        Schema schemaType = (Schema) o;
-                        Element e = schemaType.getElement();
-                        try {
-                            SchemaDocument.Schema schema = (SchemaDocument.Schema) XmlObject.Factory.parse(e);
-                            rewriteSchema(schema, contextURI, key);
-                            Element e2 = (Element) schema.newDomNode();
-                            schemaType.setElement(e2);
-                        } catch (XmlException e1) {
-                            throw new DeploymentException("Could not parse included schema",
e1);
-                        }
-                    } else if (o instanceof UnknownExtensibilityElement) {
-                        UnknownExtensibilityElement u = (UnknownExtensibilityElement) o;
-                        QName elementType = u.getElementType();
-                        if (SCHEMA_QNAME.equals(elementType)) {
-                            Element e = u.getElement();
+                if (null != types) {
+                    List schemaList = types.getExtensibilityElements();
+                    for (Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();)
{
+                        Object o = iterator1.next();
+                        if (o instanceof Schema) {
+                            Schema schemaType = (Schema) o;
+                            Element e = schemaType.getElement();
                             try {
-                                SchemaDocument schemaDocument = (SchemaDocument) SchemaInfoBuilder.parseWithNamespaces(e,
namespaceMap);
-                                SchemaDocument.Schema schema = schemaDocument.getSchema();
+                                SchemaDocument.Schema schema = (SchemaDocument.Schema) XmlObject.Factory.parse(e);
                                 rewriteSchema(schema, contextURI, key);
-                                Node node = schema.newDomNode();
-                                Element e2 = (Element) node.getFirstChild();
-                                u.setElement(e2);
+                                Element e2 = (Element) schema.newDomNode();
+                                schemaType.setElement(e2);
                             } catch (XmlException e1) {
                                 throw new DeploymentException("Could not parse included schema",
e1);
+                            }
+                        } else if (o instanceof UnknownExtensibilityElement) {
+                            UnknownExtensibilityElement u = (UnknownExtensibilityElement)
o;
+                            QName elementType = u.getElementType();
+                            if (SCHEMA_QNAME.equals(elementType)) {
+                                Element e = u.getElement();
+                                try {
+                                    SchemaDocument schemaDocument = (SchemaDocument) SchemaInfoBuilder.parseWithNamespaces(e,
namespaceMap);
+                                    SchemaDocument.Schema schema = schemaDocument.getSchema();
+                                    rewriteSchema(schema, contextURI, key);
+                                    Node node = schema.newDomNode();
+                                    Element e2 = (Element) node.getFirstChild();
+                                    u.setElement(e2);
+                                } catch (XmlException e1) {
+                                    throw new DeploymentException("Could not parse included
schema", e1);
+                                }
                             }
                         }
                     }

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java?view=diff&r1=161303&r2=161304
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/HeavyweightOperationDescBuilder.java
Thu Apr 14 08:23:31 2005
@@ -67,12 +67,13 @@
     private final SOAPBody soapBody;
 
 
-    private final Style defaultStyle;
     private final Map exceptionMap;
     private final Map complexTypeMap;
     private final Map elementMap;
     private final ClassLoader classLoader;
-    private final boolean wrappedStype;
+    private final boolean rpcStyle;
+    private final boolean documentStyle;
+    private final boolean wrappedStyle;
     private final Map publicTypes = new HashMap();
     private final Map anonymousTypes = new HashMap();
 
@@ -92,7 +93,6 @@
         super(bindingOperation);
         this.mapping = mapping;
         this.methodMapping = methodMapping;
-        this.defaultStyle = defaultStyle;
         this.exceptionMap = exceptionMap;
         this.complexTypeMap = complexTypeMap;
         this.elementMap = elementMap;
@@ -111,7 +111,21 @@
         this.serviceEndpointInterface = serviceEndpointInterface;
         BindingInput bindingInput = bindingOperation.getBindingInput();
         this.soapBody = (SOAPBody) SchemaInfoBuilder.getExtensibilityElement(SOAPBody.class,
bindingInput.getExtensibilityElements());
-        this.wrappedStype = methodMapping.isSetWrappedElement();
+
+        wrappedStyle = methodMapping.isSetWrappedElement();
+        if (false == wrappedStyle) {
+            Style style = Style.getStyle(soapOperation.getStyle(), defaultStyle);
+            if (style == Style.RPC) {
+                rpcStyle = true;
+                documentStyle = false;
+            } else {
+                rpcStyle = false;
+                documentStyle = true;
+            }
+        } else {
+            rpcStyle = false;
+            documentStyle = false;
+        }
     }
 
     public Set getWrapperElementQNames() throws DeploymentException {
@@ -152,11 +166,12 @@
         operationDesc.setName(operationName);
 
         // Set to 'document', 'rpc' or 'wrapped'
-        if (wrappedStype) {
+        if (wrappedStyle) {
             operationDesc.setStyle(Style.WRAPPED);
+        } else if (rpcStyle) {
+            operationDesc.setStyle(Style.RPC);
         } else {
-            Style style = Style.getStyle(soapOperation.getStyle(), defaultStyle);
-            operationDesc.setStyle(style);
+            operationDesc.setStyle(Style.DOCUMENT);
         }
 
         // Set to 'encoded' or 'literal'
@@ -182,7 +197,7 @@
             parameterDescriptions[position] = parameterDesc;
         }
 
-        if (wrappedStype) {
+        if (wrappedStyle) {
             Part inputPart = getWrappedPart(input);
             QName name = inputPart.getElementName();
             SchemaType operationType = (SchemaType) complexTypeMap.get(name);
@@ -243,7 +258,7 @@
             mapReturnType();
         }
 
-        if (null != output && wrappedStype) {
+        if (null != output && wrappedStyle) {
             Part inputPart = getWrappedPart(output);
             QName name = inputPart.getElementName();
             SchemaType operationType = (SchemaType) complexTypeMap.get(name);
@@ -428,20 +443,28 @@
                 throw new DeploymentException("output message part " + wsdlMessagePartName
+ " has both an INOUT or OUT mapping and a return value mapping for operation " + operationName);
             }
 
-            if (wrappedStype) {
+            if (wrappedStyle) {
                 Part outPart = getWrappedPart(output);
                 SchemaParticle returnParticle = getWrapperChild(outPart, wsdlMessagePartName);
                 //TODO this makes little sense but may be correct, see comments in axis Parameter
class
                 //the part name qname is really odd.
                 returnQName = new QName("", returnParticle.getName().getLocalPart());
                 returnType = returnParticle.getType().getName();
-            } else {
+            } else if (rpcStyle) {
                 Part part = output.getPart(wsdlMessagePartName);
                 if (part == null) {
                     throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName
+ " in output message for operation " + operationName);
                 }
                 returnQName = part.getElementName();
                 returnType = part.getTypeName();
+            } else {
+                Part part = output.getPart(wsdlMessagePartName);
+                if (part == null) {
+                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName
+ " in output message for operation " + operationName);
+                }
+                returnQName = part.getElementName();
+                //TODO mirror the Axis behavior. Why?
+                returnType = new QName(returnQName.getNamespaceURI(), ">" + returnQName.getLocalPart());
             }
 
             outParamNames.add(wsdlMessagePartName);
@@ -481,7 +504,7 @@
                 throw new DeploymentException("QName of input message: " + input.getQName()
+
                         " does not match mapping message QName: " + wsdlMessageQName + "
for operation " + operationName);
             }
-            if (wrappedStype) {
+            if (wrappedStyle) {
                 Part inPart = getWrappedPart(input);
                 // the local name of the global element refered by the part is equal to the
operation name
                 QName name = inPart.getElementName();
@@ -494,7 +517,7 @@
                 //the part name qname is really odd.
                 paramQName = new QName("", inParameter.getName().getLocalPart());
                 paramTypeQName = inParameter.getType().getName();
-            } else {
+            } else if (rpcStyle) {
                 part = input.getPart(wsdlMessagePartName);
                 if (part == null) {
                     throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName
+ " in input message for operation " + operationName);
@@ -503,17 +526,25 @@
                 //the part name qname is really odd.
                 paramQName = new QName("", part.getName());
                 paramTypeQName = part.getTypeName();
+            } else {
+                part = input.getPart(wsdlMessagePartName);
+                if (part == null) {
+                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName
+ " in input message for operation " + operationName);
+                }
+                paramQName = part.getElementName();
+                //TODO mirror the Axis behavior. Why?
+                paramTypeQName = new QName(paramQName.getNamespaceURI(), ">" + paramQName.getLocalPart());
             }
             inParamNames.add(wsdlMessagePartName);
             if (isOutParam) {
-                if (wrappedStype) {
-                    Part outPart = getWrappedPart(input);
+                if (wrappedStyle) {
+                    Part outPart = getWrappedPart(output);
                     SchemaParticle outParameter = getWrapperChild(outPart, wsdlMessagePartName);
                     if (inParameter.getType() != outParameter.getType()) {
                         throw new DeploymentException("The wrapper children " + wsdlMessagePartName
+
                                 " do not have the same type for operation " + operationName);
                     }
-                } else {
+                } else if (rpcStyle) {
                     //inout, check that part of same name and type is in output message
                     Part outPart = output.getPart(wsdlMessagePartName);
                     if (outPart == null) {
@@ -529,6 +560,14 @@
                     if (!(part.getTypeName() == null ? outPart.getTypeName() == null : part.getTypeName().equals(outPart.getTypeName())))
{
                         throw new DeploymentException("Mismatched input part type name: "
+ part.getTypeName() + " and output part type name: " + outPart.getTypeName() + " for INOUT
parameter for wsdlMessagePartName " + wsdlMessagePartName + " for operation " + operationName);
                     }
+                } else {
+                    part = output.getPart(wsdlMessagePartName);
+                    if (part == null) {
+                        throw new DeploymentException("No part for wsdlMessagePartName "
+ wsdlMessagePartName + " in output message for operation " + operationName);
+                    }
+                    paramQName = part.getElementName();
+                    //TODO mirror the Axis behavior. Why?
+                    paramTypeQName = new QName(paramQName.getNamespaceURI(), ">" + paramQName.getLocalPart());
                 }
                 outParamNames.add(wsdlMessagePartName);
             }
@@ -537,14 +576,14 @@
                 throw new DeploymentException("QName of output message: " + output.getQName()
+
                         " does not match mapping message QName: " + wsdlMessageQName + "
for operation " + operationName);
             }
-            if (wrappedStype) {
+            if (wrappedStyle) {
                 Part outPart = getWrappedPart(output);
                 SchemaParticle outParameter = getWrapperChild(outPart, wsdlMessagePartName);
                 //TODO this makes little sense but may be correct, see comments in axis Parameter
class
                 //the part name qname is really odd.
                 paramQName = new QName("", outParameter.getName().getLocalPart());
                 paramTypeQName = outParameter.getType().getName();
-            } else {
+            } else if (rpcStyle) {
                 part = output.getPart(wsdlMessagePartName);
                 if (part == null) {
                     throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName
+ " in output message for operation " + operationName);
@@ -553,6 +592,14 @@
                 //the part name qname is really odd.
                 paramQName = new QName("", part.getName());
                 paramTypeQName = part.getTypeName();
+            } else {
+                part = output.getPart(wsdlMessagePartName);
+                if (part == null) {
+                    throw new DeploymentException("No part for wsdlMessagePartName " + wsdlMessagePartName
+ " in output message for operation " + operationName);
+                }
+                paramQName = part.getElementName();
+                //TODO mirror the Axis behavior. Why?
+                paramTypeQName = new QName(paramQName.getNamespaceURI(), ">" + paramQName.getLocalPart());
             }
             outParamNames.add(wsdlMessagePartName);
         } else {

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java?view=diff&r1=161303&r2=161304
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/TypeDescBuilder.java
Thu Apr 14 08:23:31 2005
@@ -30,15 +30,14 @@
 import org.apache.axis.description.ElementDesc;
 import org.apache.geronimo.xbeans.j2ee.JavaXmlTypeMappingType;
 import org.apache.geronimo.xbeans.j2ee.VariableMappingType;
+import org.apache.geronimo.axis.server.TypeDescInfo;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.xmlbeans.SchemaType;
 
 public class TypeDescBuilder {
-    public static TypeDesc getTypeDescriptor(Class javaClass, QName typeQName, JavaXmlTypeMappingType
javaXmlTypeMapping, SchemaType schemaType) throws DeploymentException {
+    public static TypeDescInfo getTypeDescInfo(Class javaClass, QName typeQName, JavaXmlTypeMappingType
javaXmlTypeMapping, SchemaType schemaType) throws DeploymentException {
         boolean isRestriction = schemaType.getDerivationType() == SchemaType.DT_RESTRICTION;
-        TypeDesc typeDesc = new TypeDesc(javaClass, !isRestriction);
-        //TODO typeQName may be a 'anonymous" QName like construct.  Is this what axis expects?
-        typeDesc.setXmlType(typeQName);
+        
         VariableMappingType[] variableMappings = javaXmlTypeMapping.getVariableMappingArray();
         FieldDesc[] fields = new FieldDesc[variableMappings.length];
 
@@ -105,7 +104,13 @@
                 fields[i] = elementDesc;
             }
         }
-        typeDesc.setFields(fields);
-        return typeDesc;
+        
+        //TODO typeQName may be a 'anonymous" QName like construct.  Is this what axis expects?
+        return new TypeDescInfo(javaClass, isRestriction, typeQName, fields);
+    }
+    
+    public static TypeDesc getTypeDescriptor(Class javaClass, QName typeQName, JavaXmlTypeMappingType
javaXmlTypeMapping, SchemaType schemaType) throws DeploymentException {
+        TypeDescInfo info = getTypeDescInfo(javaClass, typeQName, javaXmlTypeMapping, schemaType);
+        return info.buildTypeDesc();
     }
 }

Added: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/TypeDescInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/TypeDescInfo.java?view=auto&rev=161304
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/TypeDescInfo.java
(added)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/TypeDescInfo.java
Thu Apr 14 08:23:31 2005
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  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.geronimo.axis.server;
+
+import java.io.Serializable;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.description.FieldDesc;
+import org.apache.axis.description.TypeDesc;
+
+/**
+ * @version $Rev:  $ $Date:  $
+ */
+public class TypeDescInfo implements Serializable {
+    private final Class clazz;
+    private final boolean canSearchParents;
+    private final QName xmlType;
+    private final FieldDesc[] fields;
+    
+    public TypeDescInfo(Class clazz, boolean canSearchParents, QName xmlType, FieldDesc[]
fields) {
+        this.clazz = clazz;
+        this.canSearchParents = canSearchParents;
+        this.xmlType = xmlType;
+        this.fields = fields;
+    }
+
+    public boolean isCanSearchParents() {
+        return canSearchParents;
+    }
+
+    public Class getClazz() {
+        return clazz;
+    }
+
+    public FieldDesc[] getFields() {
+        return fields;
+    }
+
+    public QName getXmlType() {
+        return xmlType;
+    }
+    
+    public TypeDesc buildTypeDesc() {
+        TypeDesc typeDesc = new TypeDesc(clazz, canSearchParents);
+        typeDesc.setXmlType(xmlType);
+        typeDesc.setFields(fields);
+        return typeDesc;
+    }
+}

Modified: geronimo/trunk/modules/jetty/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/project.xml?view=diff&r1=161303&r2=161304
==============================================================================
--- geronimo/trunk/modules/jetty/project.xml (original)
+++ geronimo/trunk/modules/jetty/project.xml Thu Apr 14 08:23:31 2005
@@ -178,6 +178,19 @@
             <version>${tranql_version}</version>
             <url>http://tranql.codehaus.org</url>
         </dependency>
+
+       <!-- TODO Needed for JettyPOJOWebServiceHolder. Move resource to geronimo-axis
-->
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-axis</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>axis</groupId>
+            <artifactId>axis</artifactId>
+            <version>${axis_version}</version>
+        </dependency>
     </dependencies>
 
 

Modified: geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java?view=diff&r1=161303&r2=161304
==============================================================================
--- geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
(original)
+++ geronimo/trunk/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
Thu Apr 14 08:23:31 2005
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import javax.security.jacc.PolicyContext;
@@ -27,6 +28,8 @@
 import javax.servlet.UnavailableException;
 import javax.servlet.ServletContext;
 
+import org.apache.axis.description.TypeDesc;
+import org.apache.geronimo.axis.server.TypeDescInfo;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
@@ -47,6 +50,7 @@
  */
 public class JettyPOJOWebServiceHolder extends ServletHolder implements GBeanLifecycle {
     private StoredObject storedWebServiceContainer;
+    private StoredObject storedClassToTypeDescInfo;
     private Set servletMappings;
     private Map webRoleRefPermissions;
     private JettyServletRegistration context;
@@ -63,6 +67,7 @@
                                      Integer loadOnStartup,
                                      Set servletMappings,
                                      Map webRoleRefPermissions,
+                                     StoredObject storedClassToTypeDescInfo,
                                      StoredObject storedWebServiceContainer,
                                      JettyServletRegistration context) throws Exception {
         super(context == null ? null : context.getServletHandler(), servletName, POJOWebServiceServlet.class.getName(),
null);
@@ -79,6 +84,8 @@
             this.servletMappings = servletMappings;
             this.webRoleRefPermissions = webRoleRefPermissions == null ? Collections.EMPTY_MAP
: webRoleRefPermissions;
         }
+
+        this.storedClassToTypeDescInfo = storedClassToTypeDescInfo;
     }
 
     //todo how do we stop/destroy the servlet?
@@ -117,6 +124,7 @@
         infoBuilder.addAttribute("loadOnStartup", Integer.class, true);
         infoBuilder.addAttribute("servletMappings", Set.class, true);
         infoBuilder.addAttribute("webRoleRefPermissions", Map.class, true);
+        infoBuilder.addAttribute("classToTypeDescInfo", StoredObject.class, true);
         infoBuilder.addAttribute("webServiceContainer", StoredObject.class, true);
         infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class);
 
@@ -126,6 +134,7 @@
                                                 "loadOnStartup",
                                                 "servletMappings",
                                                 "webRoleRefPermissions",
+                                                "classToTypeDescInfo",
                                                 "webServiceContainer",
                                                 "JettyServletRegistration"});
 
@@ -138,7 +147,14 @@
 
     public void doStart() throws Exception {
         if (context != null) {
-
+            Map classToTypeDesc = (Map) storedClassToTypeDescInfo.getObject(context.getWebClassLoader());
+            for (Iterator iter = classToTypeDesc.entrySet().iterator(); iter.hasNext();)
{
+                Map.Entry entry = (Map.Entry) iter.next();
+                Class clazz = (Class) entry.getKey();
+                TypeDescInfo typeDescInfo = (TypeDescInfo) entry.getValue();
+                TypeDesc.registerTypeDescForClass(clazz, typeDescInfo.buildTypeDesc());
+            }
+            
             Class pojoClass = context.getWebClassLoader().loadClass(pojoClassName);
             WebServiceContainer webServiceContainer = (WebServiceContainer) storedWebServiceContainer.getObject(context.getWebClassLoader());
 



Mime
View raw message