cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r534252 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/resource/ rt/core/src/main/java/org/apache/cxf/catalog/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/ rt/databinding/aegis/src/test/java/or...
Date Tue, 01 May 2007 21:49:56 GMT
Author: dkulp
Date: Tue May  1 14:49:55 2007
New Revision: 534252

URL: http://svn.apache.org/viewvc?view=rev&rev=534252
Log:
[CXF-619]  Patch from Jeff relating to HTTP addresses 
Bunch of Java -> WSDL updates to have it generate WSDL's that are much closer to the RI
generated WSDL's.
Fix problem of relative imports from a relative wsdl not working at runtime

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
    incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_localName.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/resource/ExtendedURIResolver.java
Tue May  1 14:49:55 2007
@@ -48,10 +48,14 @@
                     // imports with locations relative to it.
                     curUri = currentResolver.getURI().toString();
                 }
+                if (currentResolver.isFile()) {
+                    curUri = currentResolver.getFile().getAbsoluteFile().toURI().toString();
+                }
                 InputStream in = currentResolver.getInputStream();
                 resourceOpened.addElement(in);
                 InputSource source = new InputSource(in);               
-                source.setSystemId(curUri);                
+                source.setSystemId(curUri); 
+                source.setPublicId(lastestImportUri);
                 return source;
             }
         } catch (IOException e) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/catalog/CatalogWSDLLocator.java
Tue May  1 14:49:55 2007
@@ -64,7 +64,7 @@
     }
 
     public String getBaseURI() {
-        return baseUri;
+        return getBaseInputSource().getSystemId();
     }
 
     public String getLatestImportURI() {

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/integration/WrappedTest.java
Tue May  1 14:49:55 2007
@@ -64,9 +64,9 @@
                     + "xsd:element[@name='getSubmitBean']",
                     doc);
         assertValid("//xsd:element[@name='getSubmitBean']/xsd:complexType/xsd:sequence"
-                    + "/xsd:element[@name='bleh'][@type='string'][@nillable='true']", doc);
+                    + "/xsd:element[@name='bleh'][@type='string'][@minOccurs='0']", doc);
         assertValid("//xsd:element[@name='getSubmitBean']/xsd:complexType/xsd:sequence"
-                    + "/xsd:element[@name='bean'][@type='SimpleBean'][@nillable='true']",
doc);
+                    + "/xsd:element[@name='bean'][@type='SimpleBean'][@minOccurs='0']", doc);
 
         assertValid("/wsdl:definitions/wsdl:types"
                     + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']",
doc);
@@ -77,13 +77,13 @@
                     "/wsdl:definitions/wsdl:types"
                         + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
                         + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
-                        + "[@name=\"bleh\"][@nillable='true']",
+                        + "[@name=\"bleh\"][@minOccurs='0']",
                     doc);
         assertValid(
                     "/wsdl:definitions/wsdl:types"
                         + "/xsd:schema[@targetNamespace='http://services.aegis.cxf.apache.org']"
                         + "/xsd:complexType[@name=\"SimpleBean\"]/xsd:sequence/xsd:element"
-                        + "[@name=\"howdy\"][@nillable='true']",
+                        + "[@name=\"howdy\"][@minOccurs='0']",
                     doc);
         assertValid(
                     "/wsdl:definitions/wsdl:types"

Modified: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
(original)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/EnumTypeTest.java
Tue May  1 14:49:55 2007
@@ -113,7 +113,7 @@
 
         Document wsdl = getWSDLDocument("CurrencyService");
 
-        assertValid("//xsd:element[@name='inputCurrency'][@nillable='true']", wsdl);
+        assertValid("//xsd:element[@name='inputCurrency'][@minOccurs='0']", wsdl);
         assertValid("//xsd:simpleType[@name='Currency']/xsd:restriction[@base='string']",
wsdl);
         assertValid("//xsd:restriction[@base='string']/xsd:enumeration[@value='USD']", wsdl);
         assertValid("//xsd:restriction[@base='string']/xsd:enumeration[@value='EURO']", wsdl);

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Tue May  1 14:49:55 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.jaxb;
 
 import java.lang.reflect.Array;
+import java.lang.reflect.Field;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -50,8 +51,25 @@
             return;
         }
 
+        boolean isFromWrapper = part.getMessageInfo().getOperation().isUnwrapped();
+        if (isFromWrapper 
+            && clazz.isArray() 
+            && !Byte.TYPE.equals(clazz.getComponentType())) {
+            clazz = clazz.getComponentType();
+        }
+        
         Type genericType = (Type) part.getProperty("generic.type");
         if (genericType != null) {
+            if (isFromWrapper
+                && genericType instanceof Class
+                && ((Class)genericType).isArray()) {
+                
+                Class cl2 = (Class)genericType;
+                if (cl2.isArray()
+                    && !Byte.TYPE.equals(cl2.getComponentType())) {
+                    genericType = cl2.getComponentType();
+                }
+            }
             addType(genericType);
             
             if (Collection.class.isAssignableFrom(clazz) 
@@ -91,21 +109,28 @@
         if (cls.isArray() && cls.getComponentType().isPrimitive()) {
             return;
         }
-        cls = JAXBUtils.getValidClass(cls);
-        if (null != cls) {
-            if (cls.isEnum()) {
-                // The object factory stuff doesn't work for enums
-                classes.add(cls);
+        if (Exception.class.isAssignableFrom(cls)) {
+            for (Field f : cls.getDeclaredFields()) {
+                addClass(f.getType());
             }
-            String name = PackageUtils.getPackageName(cls) + ".ObjectFactory";
-            try {
-                cls = Class.forName(name, false, cls.getClassLoader());
-                if (cls != null) {
+            addClass(String.class);
+        } else {
+            cls = JAXBUtils.getValidClass(cls);
+            if (null != cls) {
+                if (cls.isEnum()) {
+                    // The object factory stuff doesn't work for enums
+                    classes.add(cls);
+                }
+                String name = PackageUtils.getPackageName(cls) + ".ObjectFactory";
+                try {
+                    cls = Class.forName(name, false, cls.getClassLoader());
+                    if (cls != null) {
+                        classes.add(cls);
+                    }
+                } catch (ClassNotFoundException ex) {
+                    // cannot add factory, just add the class
                     classes.add(cls);
                 }
-            } catch (ClassNotFoundException ex) {
-                // cannot add factory, just add the class
-                classes.add(cls);
             }
         }
     }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
(original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java
Tue May  1 14:49:55 2007
@@ -19,18 +19,32 @@
 
 package org.apache.cxf.jaxb;
 
+import java.lang.reflect.Field;
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
 import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
 import com.sun.xml.bind.v2.runtime.JaxBeanInfo;
 
 import org.apache.cxf.service.ServiceModelVisitor;
+import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.wsdl.WSDLConstants;
+import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaForm;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaSerializer;
+import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
 
 /**
  * Walks the service model and sets up the element/type names.
@@ -58,8 +72,19 @@
             return;
         }
 
+        boolean isFromWrapper = part.getMessageInfo().getOperation().isUnwrapped();
+        if (isFromWrapper && clazz.isArray() && !Byte.TYPE.equals(clazz.getComponentType()))
{
+            clazz = clazz.getComponentType();
+        }
+
         JaxBeanInfo<?> beanInfo = context.getBeanInfo(clazz);
+        
         if (beanInfo == null) {
+            if (Exception.class.isAssignableFrom(clazz)) {
+                QName name = part.getMessageInfo().getName();
+                part.setElementQName(name);
+                buildExceptionType(part, clazz);
+            }
             return;
         }
         
@@ -85,5 +110,105 @@
             part.setTypeQName(typeName);
             part.setXmlSchema(schemas.getTypeByQName(typeName));
         }
+    } 
+    
+    private void buildExceptionType(MessagePartInfo part, Class cls) {
+        SchemaInfo schemaInfo = null;
+        for (SchemaInfo s : serviceInfo.getSchemas()) {
+            if (s.getNamespaceURI().equals(part.getElementQName().getNamespaceURI())) {
+                schemaInfo = s;
+                break;
+            }
+        }
+        XmlSchema schema;
+        if (schemaInfo == null) {
+            schema = new XmlSchema(part.getElementQName().getNamespaceURI(), schemas);
+            schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
+
+            NamespaceMap nsMap = new NamespaceMap();
+            nsMap.add(WSDLConstants.NP_SCHEMA_XSD, WSDLConstants.NU_SCHEMA_XSD);
+            schema.setNamespaceContext(nsMap);
+
+            
+            schemaInfo = new SchemaInfo(serviceInfo, part.getElementQName().getNamespaceURI());
+            schemaInfo.setSchema(schema);
+            serviceInfo.addSchema(schemaInfo);
+        } else {
+            schema = schemaInfo.getSchema();
+        }
+        
+        XmlSchemaElement el = new XmlSchemaElement();
+        el.setQName(part.getElementQName());
+        el.setName(part.getElementQName().getLocalPart());
+        schema.getItems().add(el);
+        
+        XmlSchemaComplexType ct = new XmlSchemaComplexType(schema);
+        el.setSchemaType(ct);
+        
+        XmlSchemaSequence seq = new XmlSchemaSequence();
+        ct.setParticle(seq);
+        String namespace = part.getElementQName().getNamespaceURI();
+        for (Field f : cls.getDeclaredFields()) {
+            JaxBeanInfo<?> beanInfo = context.getBeanInfo(f.getType());
+            if (beanInfo != null) {
+                el = new XmlSchemaElement();
+                el.setName(f.getName());
+                el.setQName(new QName(namespace, f.getName()));
+
+                el.setMinOccurs(1);
+                el.setMaxOccurs(1);
+                el.setNillable(true);
+
+                if (beanInfo.isElement()) {
+                    QName name = new QName(beanInfo.getElementNamespaceURI(null), 
+                                           beanInfo.getElementLocalName(null));
+                    XmlSchemaElement el2 = schemas.getElementByQName(name);
+                    el.setRefName(el2.getRefName());
+                } else {
+                    Iterator<QName> itr = beanInfo.getTypeNames().iterator();
+                    if (!itr.hasNext()) {
+                        continue;
+                    }
+                    QName typeName = itr.next();
+                    el.setSchemaTypeName(typeName);
+                }
+                
+                seq.getItems().add(el);
+            }
+        }
+        JaxBeanInfo<?> beanInfo = context.getBeanInfo(String.class);    
+        el = new XmlSchemaElement();
+        el.setName("message");
+        el.setQName(new QName(namespace, "message"));
+
+        el.setMinOccurs(1);
+        el.setMaxOccurs(1);
+        el.setNillable(true);
+
+        if (beanInfo.isElement()) {
+            el.setRefName(beanInfo.getTypeName(null));
+        } else {
+            el.setSchemaTypeName(beanInfo.getTypeName(null));
+        }
+        seq.getItems().add(el);
+            
+        Document[] docs;
+        try {
+            docs = XmlSchemaSerializer.serializeSchema(schema, false);
+        } catch (XmlSchemaSerializerException e1) {
+            throw new ServiceConstructionException(e1);
+        }
+        Element e = docs[0].getDocumentElement();
+        schemaInfo.setElement(e);
+        // XXX A problem can occur with the ibm jdk when the XmlSchema
+        // object is serialized.  The xmlns declaration gets incorrectly
+        // set to the same value as the targetNamespace attribute.
+        // The aegis databinding tests demonstrate this particularly.
+        if (e.getPrefix() == null && !WSDLConstants.NU_SCHEMA_XSD.equals(
+            e.getAttributeNS(WSDLConstants.NU_XMLNS, WSDLConstants.NP_XMLNS))) {
+            e.setAttributeNS(WSDLConstants.NU_XMLNS, 
+                WSDLConstants.NP_XMLNS, WSDLConstants.NU_SCHEMA_XSD);
+        }
+        schemaInfo.setElement(e);
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Tue May  1 14:49:55 2007
@@ -292,6 +292,11 @@
     @Override
     protected Class<?> getBeanClass(Class<?> exClass) {
         try {
+            if (java.rmi.ServerException.class.isAssignableFrom(exClass)
+                || java.rmi.RemoteException.class.isAssignableFrom(exClass)) {
+                return null;
+            }
+            
             Method getFaultInfo = exClass.getMethod("getFaultInfo", new Class[0]);
 
             return getFaultInfo.getReturnType();

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Tue May  1 14:49:55 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.service.factory;
 
 import java.lang.reflect.Array;
+import java.lang.reflect.Field;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
@@ -218,7 +219,6 @@
         
         getDataBinding().initialize(service);
         
-        
         boolean overLoaded = containsOverloadedMethod();
         boolean isWrapped = isWrapped();
         if (isWrapped && !overLoaded) {
@@ -246,7 +246,6 @@
             }
 
         }
-        
     }
     
     private boolean containsOverloadedMethod() {
@@ -403,22 +402,6 @@
                     p.setConcreteName(p.getName());
                 }
             }
-            
-            for (FaultInfo fault : uOp.getFaults()) {
-                Class expClz = (Class) fault.getProperty(Class.class.getName());
-                if (Exception.class.isAssignableFrom(getBeanClass(expClz))) {
-                    QName name = uOp.getFault(fault.getFaultName()).getName();
-                    FaultInfo faultInfo = new FaultInfo(name, name, op);
-                    faultInfo.setProperty("unwrapped.fault.info", fault);
-                    faultInfo.setProperty(Class.class.getName(), fault.getProperty(Class.class.getName()));
-                    op.addFault(faultInfo);
-                    
-                    createFaultWrappedMessageParts(faultInfo);
-                }
-                for (MessagePartInfo p : fault.getMessageParts()) {
-                    p.setConcreteName(p.getName());
-                }
-            }
         } else {
             createMessageParts(intf, op, m);
         }
@@ -460,18 +443,6 @@
                             .getOutput(), wraperBeanName);
                     }
                 }
-                
-                if (!op.getFaults().isEmpty()) {
-                    for (FaultInfo faultInfo : op.getFaults()) {
-                        Class expClz = (Class) faultInfo.getProperty(Class.class.getName());
-                        if (Exception.class.isAssignableFrom(getBeanClass(expClz))) {
-                            createWrappedSchema(serviceInfo,
-                                                faultInfo,
-                                                (FaultInfo) faultInfo.getProperty("unwrapped.fault.info"),
-                                                faultInfo.getFaultName());
-                        }
-                    }
-                }                
             }
         }
 
@@ -642,9 +613,18 @@
             el.setName(mpi.getName().getLocalPart());
             el.setQName(mpi.getName());
 
-            el.setMinOccurs(1);
-            el.setMaxOccurs(1);
-            el.setNillable(true);
+            if (mpi.getTypeClass() != null 
+                && mpi.getTypeClass().isArray()
+                && !Byte.TYPE.equals(mpi.getTypeClass().getComponentType())) {
+                el.setMinOccurs(0);
+                el.setMaxOccurs(Long.MAX_VALUE);
+            } else {
+                el.setMaxOccurs(1);
+                if (mpi.getTypeClass() != null 
+                    && !mpi.getTypeClass().isPrimitive()) {
+                    el.setMinOccurs(0);
+                }
+            }
 
             if (mpi.isElement()) {
                 el.setRefName(mpi.getElementQName());
@@ -979,27 +959,35 @@
 
     protected FaultInfo addFault(final InterfaceInfo service, final OperationInfo op, Class
exClass) {
         Class beanClass = getBeanClass(exClass);
+        if (beanClass == null) {
+            return null;
+        }
 
         QName faultName = getFaultName(service, op, exClass, beanClass);
         FaultInfo fi = op.addFault(faultName, faultName);
         fi.setProperty(Class.class.getName(), exClass);
-
-        
-        MessagePartInfo mpi = fi.addMessagePart(faultName);
-
-        if (Exception.class.isAssignableFrom(beanClass)) {
-            beanClass = String.class;
-            mpi.setName(new QName(faultName.getNamespaceURI(), "message"));
-            mpi.setTypeQName(new QName("http://www.w3.org/2001/XMLSchema", "string"));
-            fi.setProperty("unwrapped.fault.info", fi);
-        }
         
+        MessagePartInfo mpi = fi.addMessagePart(new QName(op.getName().getNamespaceURI(),
"fault"));
         mpi.setTypeClass(beanClass);
-        
         return fi;
     }
 
+    protected void createFaultForException(Class<?> exClass, FaultInfo fi) {
+        Field fields[] = exClass.getDeclaredFields(); 
+        for (Field field : fields) {
+            MessagePartInfo mpi = fi.addMessagePart(new QName(fi.getName().getNamespaceURI(),
+                                                              field.getName()));
+            mpi.setProperty(Class.class.getName(), field.getType());
+        }
+        MessagePartInfo mpi = fi.addMessagePart(new QName(fi.getName().getNamespaceURI(),
+                                                          "message"));
+        mpi.setProperty(Class.class.getName(), String.class);
+    }
+    
     protected Class<?> getBeanClass(Class<?> exClass) {
+        if (java.rmi.RemoteException.class.isAssignableFrom(exClass)) {
+            return null;
+        }
         return exClass;
     }
 

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
Tue May  1 14:49:55 2007
@@ -218,7 +218,10 @@
     
     protected static EndpointInfo getAddressValue(EndpointInfo ei, boolean dp) {       
         if (dp) {
-            ei.setAddress(StringUtils.addDefaultPortIfMissing(ei.getAddress()));
+            String addr = StringUtils.addDefaultPortIfMissing(ei.getAddress());
+            if (addr != null) {
+                ei.setAddress(addr);
+            }
         } 
         return ei;
     }

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/calculator.wsdl
Tue May  1 14:49:55 2007
@@ -20,25 +20,25 @@
 <wsdl:definitions name="Calculator" targetNamespace="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/"
xmlns:ns1="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:types>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://docwrapped.classnoanno.fortest.tools.cxf.apache.org/">
-<xsd:element name="add">
+<xsd:element name="AddException">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="a" nillable="true" type="xsd:int"/>
-<xsd:element name="b" nillable="true" type="xsd:int"/>
+<xsd:element name="message" nillable="true" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
-<xsd:element name="addResponse">
+<xsd:element name="add">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:int"/>
+<xsd:element name="a" type="xsd:int"/>
+<xsd:element name="b" type="xsd:int"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
-<xsd:element name="AddException">
+<xsd:element name="addResponse">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="message" nillable="true" type="xsd:string"/>
+<xsd:element name="return" type="xsd:int"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/db.wsdl
Tue May  1 14:49:55 2007
@@ -19,7 +19,7 @@
 -->
 <wsdl:definitions name="Database" targetNamespace="http://cxf523.fortest.tools.cxf.apache.org/"
xmlns:ns1="http://cxf523.fortest.tools.cxf.apache.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:types>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://cxf523.fortest.tools.cxf.apache.org/"
attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://cxf523.fortest.tools.cxf.apache.org/">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://cxf523.fortest.tools.cxf.apache.org/"
attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://cxf523.fortest.tools.cxf.apache.org/">
 <xs:complexType name="operation0ResponseType">
 <xs:sequence>
 <xs:element minOccurs="0" name="birth" type="xs:dateTime"/>
@@ -30,11 +30,13 @@
 <xs:element minOccurs="0" name="species" type="xs:string"/>
 </xs:sequence>
 </xs:complexType>
-<xs:complexType final="#all" name="operation0ResponseTypeArray">
+<xs:element name="DBServiceFault">
+<xs:complexType>
 <xs:sequence>
-<xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="tns:operation0ResponseType"/>
+<xs:element name="message" nillable="true" type="xs:string"/>
 </xs:sequence>
 </xs:complexType>
+</xs:element>
 <xs:element name="operation0">
 <xs:complexType>
 <xs:sequence/>
@@ -43,21 +45,7 @@
 <xs:element name="operation0Response">
 <xs:complexType>
 <xs:sequence>
-<xs:element name="return" nillable="true" type="tns:operation0ResponseTypeArray"/>
-</xs:sequence>
-</xs:complexType>
-</xs:element>
-<xs:element name="RemoteException">
-<xs:complexType>
-<xs:sequence>
-<xs:element name="message" nillable="true" type="xs:string"/>
-</xs:sequence>
-</xs:complexType>
-</xs:element>
-<xs:element name="DBServiceFault">
-<xs:complexType>
-<xs:sequence>
-<xs:element name="message" nillable="true" type="xs:string"/>
+<xs:element maxOccurs="unbounded" minOccurs="0" name="return" type="operation0ResponseType"/>
 </xs:sequence>
 </xs:complexType>
 </xs:element>
@@ -67,10 +55,6 @@
     <wsdl:part name="operation0" element="ns1:operation0">
     </wsdl:part>
   </wsdl:message>
-  <wsdl:message name="RemoteException">
-    <wsdl:part name="fault" element="ns1:RemoteException">
-    </wsdl:part>
-  </wsdl:message>
   <wsdl:message name="DBServiceFault">
     <wsdl:part name="fault" element="ns1:DBServiceFault">
     </wsdl:part>
@@ -87,8 +71,6 @@
     </wsdl:output>
       <wsdl:fault name="DBServiceFault" message="ns1:DBServiceFault">
     </wsdl:fault>
-      <wsdl:fault name="RemoteException" message="ns1:RemoteException">
-    </wsdl:fault>
     </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="DatabaseSoapBinding" type="ns1:DatabasePortType">
@@ -103,9 +85,6 @@
       </wsdl:output>
       <wsdl:fault name="DBServiceFault">
         <soap:fault name="DBServiceFault" use="literal"/>
-      </wsdl:fault>
-      <wsdl:fault name="RemoteException">
-        <soap:fault name="RemoteException" use="literal"/>
       </wsdl:fault>
     </wsdl:operation>
   </wsdl:binding>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/hello_soap12.wsdl
Tue May  1 14:49:55 2007
@@ -55,7 +55,7 @@
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="faultDetail">
-    <wsdl:part name="faultDetail" element="ns2:faultDetail">
+    <wsdl:part name="fault" element="ns2:faultDetail">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="pingMeResponse">

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/expected/my_hello_soap12.wsdl
Tue May  1 14:49:55 2007
@@ -37,7 +37,7 @@
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="faultDetail">
-    <wsdl:part name="faultDetail" element="ns2:faultDetail">
+    <wsdl:part name="fault" element="ns2:faultDetail">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="pingMeResponse">

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_localName.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_localName.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_localName.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_localName.wsdl
Tue May  1 14:49:55 2007
@@ -39,14 +39,14 @@
 <xsd:element name="getPrice">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="arg0" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="getPriceResponse">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:float"/>
+<xsd:element name="return" type="xsd:float"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl
Tue May  1 14:49:55 2007
@@ -28,7 +28,7 @@
 <xsd:element name="sayHiWithoutWrapperClassResponse">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="return" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_hello_world_doc_lit.wsdl
Tue May  1 14:49:55 2007
@@ -121,7 +121,7 @@
     </wsdl:input>
       <wsdl:output name="pingMeResponse" message="ns1:pingMeResponse">
     </wsdl:output>
-      <wsdl:fault name="faultDetail" message="ns2:faultDetail">
+      <wsdl:fault name="fault" message="ns2:faultDetail">
     </wsdl:fault>
     </wsdl:operation>
   </wsdl:portType>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_holder.wsdl
Tue May  1 14:49:55 2007
@@ -23,48 +23,48 @@
 <xsd:element name="echo">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="arg0" nillable="true" type="xsd:string"/>
-<xsd:element name="arg1" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
+<xsd:element minOccurs="0" name="arg1" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="echoResponse">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:string"/>
-<xsd:element name="return1" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="return" type="xsd:string"/>
+<xsd:element minOccurs="0" name="return1" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="echo3">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element nillable="true" ref="header"/>
-<xsd:element name="arg1" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" ref="header"/>
+<xsd:element minOccurs="0" name="arg1" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="echo3Response">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:string"/>
-<xsd:element nillable="true" ref="header"/>
+<xsd:element minOccurs="0" name="return" type="xsd:string"/>
+<xsd:element minOccurs="0" ref="header"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="echo2">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="arg0" nillable="true" type="xsd:string"/>
-<xsd:element name="arg1" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
+<xsd:element minOccurs="0" name="arg1" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="echo2Response">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:string"/>
-<xsd:element name="return1" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="return" type="xsd:string"/>
+<xsd:element minOccurs="0" name="return1" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl?view=diff&rev=534252&r1=534251&r2=534252
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/stock_noanno_wrapped.wsdl
Tue May  1 14:49:55 2007
@@ -23,14 +23,14 @@
 <xsd:element name="getPrice">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="arg0" nillable="true" type="xsd:string"/>
+<xsd:element minOccurs="0" name="arg0" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>
 <xsd:element name="getPriceResponse">
 <xsd:complexType>
 <xsd:sequence>
-<xsd:element name="return" nillable="true" type="xsd:float"/>
+<xsd:element name="return" type="xsd:float"/>
 </xsd:sequence>
 </xsd:complexType>
 </xsd:element>



Mime
View raw message