You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2008/01/15 18:11:47 UTC

svn commit: r612160 - /incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java

Author: rfeng
Date: Tue Jan 15 09:11:43 2008
New Revision: 612160

URL: http://svn.apache.org/viewvc?rev=612160&view=rev
Log:
Fix for TUSCANY-1938

Modified:
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java?rev=612160&r1=612159&r2=612160&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java Tue Jan 15 09:11:43 2008
@@ -31,6 +31,7 @@
 import javax.wsdl.Message;
 import javax.wsdl.Output;
 import javax.wsdl.Part;
+import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
@@ -63,6 +64,7 @@
  */
 public class WSDLOperationIntrospectorImpl {
     private static final Logger logger = Logger.getLogger(WSDLOperationIntrospectorImpl.class.getName());
+    private final static QName ANY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "any");
 
     private WSDLFactory wsdlFactory;
     private ModelResolver resolver;
@@ -106,8 +108,9 @@
     public boolean isWrapperStyle() throws InvalidWSDLException {
         if (wrapperStyle == null) {
             wrapperStyle =
-                (operation.getInput() == null || operation.getInput().getMessage().getParts().size() == 0 || wrapper.getInputChildElements() != null) && 
-                (operation.getOutput() == null || operation.getOutput().getMessage().getParts().size() == 0 || wrapper.getOutputChildElements() != null);
+                (operation.getInput() == null || operation.getInput().getMessage().getParts().size() == 0 || wrapper
+                    .getInputChildElements() != null) && (operation.getOutput() == null || operation.getOutput()
+                    .getMessage().getParts().size() == 0 || wrapper.getOutputChildElements() != null);
         }
         return wrapperStyle;
     }
@@ -382,12 +385,25 @@
             for (int i = 0; i < items.getCount(); i++) {
                 XmlSchemaObject schemaObject = items.getItem(i);
                 if (!(schemaObject instanceof XmlSchemaElement)) {
+                    // Should contain elements only
                     return null;
                 }
                 XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
+                /*
+                if (childElement.getSubstitutionGroup() != null) {
+                    return null;
+                }
+                */
                 if (childElement.getName() == null || childElement.getRefName() != null) {
-                    // FIXME: [rfeng] Not very clear if the JAX-WS spec allows element-ref
-                    // return null;
+                    XmlSchemaElement ref = getElement(childElement.getRefName());
+                    if (ref == null) {
+                        throw new InvalidWSDLException("XML schema element ref cannot be resolved: " + childElement);
+                    }
+                    childElement = ref;
+                }
+                if (ANY.equals(childElement.getQName())) {
+                    // Wildcard is not allowed
+                    return null;
                 }
                 // TODO: Do we support maxOccurs >1 ?
                 if (childElement.getMaxOccurs() > 1) {
@@ -434,6 +450,10 @@
                     throw new InvalidWSDLException("The element is not declared in a XML schema: " + elementName
                         .toString());
                 }
+                if (inputWrapperElement.isNillable()) {
+                    // The wrapper element cannot be nilable
+                    return null;
+                }
                 inputElements = getChildElements(inputWrapperElement);
                 return inputElements;
             } else {
@@ -466,6 +486,10 @@
                 }
                 outputWrapperElement = WSDLOperationIntrospectorImpl.this.getElement(elementName);
                 if (outputWrapperElement == null) {
+                    return null;
+                }
+                if (outputWrapperElement.isNillable()) {
+                    // The wrapper element cannot be nilable
                     return null;
                 }
                 outputElements = getChildElements(outputWrapperElement);



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org