You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2008/06/22 22:26:28 UTC

svn commit: r670410 - in /tuscany/branches/sca-java-1.3/modules: binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/ binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/ binding-ws-axis2/src/test/resources/...

Author: nash
Date: Sun Jun 22 13:26:27 2008
New Revision: 670410

URL: http://svn.apache.org/viewvc?rev=670410&view=rev
Log:
Fix TUSCANY-2418

Added:
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java
      - copied, changed from r670360, tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCaseFIXME.java
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java
      - copied, changed from r670360, tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl
Removed:
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCaseFIXME.java
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java
Modified:
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl
    tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl
    tuscany/branches/sca-java-1.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
    tuscany/branches/sca-java-1.3/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java

Modified: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java Sun Jun 22 13:26:27 2008
@@ -27,6 +27,7 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -38,6 +39,8 @@
 import javax.wsdl.Definition;
 import javax.wsdl.Import;
 import javax.wsdl.Port;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.extensions.soap12.SOAP12Address;
 import javax.xml.namespace.QName;
@@ -85,6 +88,7 @@
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
@@ -98,12 +102,22 @@
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.xsd.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaExternal;
 import org.apache.ws.security.WSSecurityEngineResult;
 import org.apache.ws.security.handler.WSHandlerConstants;
 import org.apache.ws.security.handler.WSHandlerResult;
 import org.osoa.sca.ServiceRuntimeException;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
 
 public class Axis2ServiceProvider {
+    public static final String IMPORT_TAG = "import";
+    public static final String INCLUDE_TAG = "include";
     
     private static final Logger logger = Logger.getLogger(Axis2ServiceProvider.class.getName());    
 
@@ -129,6 +143,21 @@
 
     private static final String DEFAULT_QUEUE_CONNECTION_FACTORY = "TuscanyQueueConnectionFactory";
 
+    //Schema element names
+    public static final String ELEM_SCHEMA = "schema";
+
+    //Schema URI
+    public static final String NS_URI_XSD_1999 = "http://www.w3.org/1999/XMLSchema";
+    public static final String NS_URI_XSD_2000 = "http://www.w3.org/2000/10/XMLSchema";
+    public static final String NS_URI_XSD_2001 = "http://www.w3.org/2001/XMLSchema";
+
+    //Schema QNames
+    public static final QName Q_ELEM_XSD_1999 = new QName(NS_URI_XSD_1999, ELEM_SCHEMA);
+    public static final QName Q_ELEM_XSD_2000 = new QName(NS_URI_XSD_2000, ELEM_SCHEMA);
+    public static final QName Q_ELEM_XSD_2001 = new QName(NS_URI_XSD_2001, ELEM_SCHEMA);
+    public static final List<QName> XSD_QNAME_LIST =
+        Arrays.asList(new QName[] {Q_ELEM_XSD_1999, Q_ELEM_XSD_2000, Q_ELEM_XSD_2001});
+
     public Axis2ServiceProvider(RuntimeComponent component,
                                 AbstractContract contract,
                                 WebServiceBinding wsBinding,
@@ -290,8 +319,7 @@
                 URI uriPath = new URI(endpointURL);
                 String stringURIPath = uriPath.getPath();
             
-                //[nash] Need a leading slash for WSDL imports to work with ?wsdl
-                /*
+                /* [nash] Need a leading slash for WSDL imports to work with ?wsdl
                 // remove any "/" from the start of the path
                 if (stringURIPath.startsWith("/")) {
                     stringURIPath = stringURIPath.substring(1, stringURIPath.length());
@@ -425,6 +453,9 @@
             }
         }
 
+        // Add schema information to the AxisService (needed for "?xsd=" support)
+        addSchemas(wsBinding.getWSDLDefinition(), axisService);
+
         // Use the existing WSDL
         Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null);
         wsdlParam.setValue(definition);
@@ -432,6 +463,12 @@
         Parameter userWSDL = new Parameter("useOriginalwsdl", "true");
         axisService.addParameter(userWSDL);
 
+        // Modify schema imports and includes to add "servicename?xsd=" prefix.
+        // Axis2 does this for schema extensibility elements, but Tuscany has
+        // overriden the WSDl4J deserializer to create UnknownExtensibilityElement
+        // elements in place of these.
+        modifySchemaImportsAndIncludes(definition, name);
+
         // Axis2 1.3 has a bug with returning incorrect values for the port
         // addresses.  To work around this, compute the values here.
         Parameter modifyAddr = new Parameter("modifyUserWSDLPortAddress", "false");
@@ -447,6 +484,74 @@
         return axisService;
     }
 
+    private void addSchemas(WSDLDefinition wsdlDef, AxisService axisService) {
+        for (XSDefinition xsDef : wsdlDef.getXmlSchemas()) {
+            axisService.addSchema(xsDef.getSchema());
+            updateSchemaRefs(xsDef.getSchema(), axisService.getName());
+        }
+        for (WSDLDefinition impDef : wsdlDef.getImportedDefinitions()) {
+            addSchemas(impDef, axisService);
+        }
+    }
+
+    private void updateSchemaRefs(XmlSchema parentSchema, String name) {
+        for (Iterator iter = parentSchema.getIncludes().getIterator(); iter.hasNext();) {
+            Object obj = iter.next();
+            if (obj instanceof XmlSchemaExternal) {
+                XmlSchemaExternal extSchema = (XmlSchemaExternal)obj;
+                String location = extSchema.getSchemaLocation();
+                if (location.indexOf(":/") < 0 & location.indexOf("?xsd=") < 0) {
+                    extSchema.setSchemaLocation(name + "?xsd=" + location);
+                }
+                updateSchemaRefs(extSchema.getSchema(), name);
+            }
+        }
+    }
+
+    private void modifySchemaImportsAndIncludes(Definition definition, String name){
+        // adjust the schema locations in types section
+        Types types = definition.getTypes();
+        if (types != null) {
+            for (Iterator iter = types.getExtensibilityElements().iterator(); iter.hasNext();) {
+                Object ext = iter.next();
+                if (ext instanceof UnknownExtensibilityElement &&
+                    XSD_QNAME_LIST.contains(((UnknownExtensibilityElement)ext).getElementType())) {
+                    changeLocations(((UnknownExtensibilityElement)ext).getElement(), name);
+                }
+            }
+        }
+        for (Iterator iter = definition.getImports().values().iterator(); iter.hasNext();) {
+            Vector values = (Vector)iter.next();
+            for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
+                Import wsdlImport = (Import)valuesIter.next();
+                modifySchemaImportsAndIncludes(wsdlImport.getDefinition(), name);
+            }
+        }
+    }
+
+    private void changeLocations(Element element, String name) {
+        NodeList nodeList = element.getChildNodes();
+        for (int i = 0; i < nodeList.getLength(); i++) {
+            String tagName = nodeList.item(i).getLocalName();
+            if (IMPORT_TAG.equals(tagName) || INCLUDE_TAG.equals(tagName)) {
+                processImport(nodeList.item(i), name);
+            }
+        }
+    }
+
+    private void processImport(Node importNode, String name) {
+        NamedNodeMap nodeMap = importNode.getAttributes();
+        for (int i = 0; i < nodeMap.getLength(); i++) {
+            Node attribute = nodeMap.item(i);
+            if (attribute.getNodeName().equals("schemaLocation")) {
+                String location = attribute.getNodeValue();
+                if (location.indexOf(":/") < 0 & location.indexOf("?xsd=") < 0) {
+                    attribute.setNodeValue(name + "?xsd=" + location);
+                }
+            }
+        }
+    }
+
     private String getPortAddress(Port port) {
         Object ext = port.getExtensibilityElements().get(0);
         if (ext instanceof SOAPAddress) {
@@ -606,8 +711,8 @@
     }
     
     private void createPolicyHandlers() throws IllegalAccessException,
-                                                              InstantiationException, 
-                                                              ClassNotFoundException {
+                                               InstantiationException, 
+                                               ClassNotFoundException {
         if (wsBinding instanceof PolicySetAttachPoint) {
             PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
             PolicyHandler policyHandler = null;

Modified: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java Sun Jun 22 13:26:27 2008
@@ -58,6 +58,7 @@
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyRegistry;
 import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaExternal;
 
 /**
  * A Tuscany specific Axis2 ListingAgent as the Axis2 one does not work
@@ -86,6 +87,68 @@
         return serviceName;
     }
 
+    /**
+     * Override ?xsd processing so that WSDL documents with XSD imports
+     * and includes work correctly.  When we move to Axis2 1.4, we may
+     * be able to use SchemaSupplier to do this in a cleaner way.
+     */
+    @Override
+    public void processListService(HttpServletRequest req,
+                                   HttpServletResponse res)
+            throws IOException, ServletException {
+
+        String url = req.getRequestURL().toString();
+        String query = req.getQueryString();
+        int xsd = query.indexOf("xsd");
+        if (xsd >= 0) {
+            String serviceName = extractServiceName(url);
+            HashMap services = configContext.getAxisConfiguration().getServices();
+            if ((services != null) && !services.isEmpty()) {
+                Object serviceObj = services.get(serviceName);
+                if (serviceObj != null) {
+                    String xsds = req.getParameter("xsd");
+                    if (xsds != null && !"".equals(xsds)) {
+                        // a schema name (perhaps with path) is present
+                        AxisService axisService = (AxisService)serviceObj;
+                        ArrayList schemas = axisService.getSchema();
+                        for (Object rootSchema : axisService.getSchema()) {
+                            XmlSchema schema = getSchema(((XmlSchema)rootSchema), xsds);
+                            if (schema != null) {
+                                // found the schema
+                                res.setContentType("text/xml");
+                                OutputStream out = res.getOutputStream();
+                                schema.write(new OutputStreamWriter(out, "UTF8"));
+                                out.flush();
+                                out.close();
+                                return;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        // in all other cases, delegate to the Axis2 code
+        super.processListService(req, res);
+    }
+
+    private XmlSchema getSchema(XmlSchema parentSchema, String name) {
+        for (Iterator iter = parentSchema.getIncludes().getIterator(); iter.hasNext();) {
+            Object obj = iter.next();
+            if (obj instanceof XmlSchemaExternal) {
+                XmlSchemaExternal extSchema = (XmlSchemaExternal)obj;
+                if (extSchema.getSchemaLocation().endsWith(name)) {
+                    return extSchema.getSchema();
+                } else {
+                    XmlSchema schema = getSchema(extSchema.getSchema(), name);
+                    if (schema != null) {
+                        return schema;
+                    }
+                }
+            }
+        }
+        return null;
+    }
+
     private String findAxisServiceName(String path) {
         HashMap services = configContext.getAxisConfiguration().getServices();
         if (services == null) {
@@ -130,106 +193,4 @@
         }
     }
 
-    private String extractHostAndPort(String filePart, boolean isHttp) {
-        int ipindex = filePart.indexOf("//");
-        String ip = null;
-        if (ipindex >= 0) {
-            ip = filePart.substring(ipindex + 2, filePart.length());
-            int seperatorIndex = ip.indexOf(":");
-            int slashIndex = ip.indexOf("/");
-            String port;
-            if (seperatorIndex >= 0) {
-                port = ip.substring(seperatorIndex + 1, slashIndex);
-                ip = ip.substring(0, seperatorIndex);
-            } else {
-                ip = ip.substring(0, slashIndex);
-                port = "80";
-            }
-            if (isHttp) {
-                configContext.setProperty(RUNNING_PORT, port);
-            }
-        }
-        return ip;
-    }
-
-    private Policy findPolicy(String id, AxisDescription des) {
-
-        List policyElements = des.getPolicyInclude().getPolicyElements();
-        PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry();
-
-        Object policyComponent;
-
-        Policy policy = registry.lookup(id);
-
-        if (policy != null) {
-            return policy;
-        }
-
-        for (Iterator iterator = policyElements.iterator(); iterator.hasNext();) {
-            policyComponent = iterator.next();
-
-            if (policyComponent instanceof Policy) {
-                // policy found for the id
-
-                if (id.equals(((Policy) policyComponent).getId())) {
-                    return (Policy) policyComponent;
-                }
-            }
-        }
-
-        AxisDescription child;
-
-        for (Iterator iterator = des.getChildren(); iterator.hasNext();) {
-            child = (AxisDescription) iterator.next();
-            policy = findPolicy(id, child);
-
-            if (policy != null) {
-                return policy;
-            }
-        }
-
-        return null;
-    }
-
-    /**
-     * Hack to get ?wsdl working with soap 1.2 
-     * Fixed in Axis2 1.3
-     */
-    private void patchSOAP12Port(AxisService as) throws AxisFault {
-        Parameter wsld4jdefinition = as.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
-        Definition definition = (Definition) wsld4jdefinition.getValue();
-        setPortAddress(definition, null, as);
-    }
-
-    /**
-     * This is a copy of the AxisService setPortAddress patched to work with SOAP 1.2 Addresses
-     * Fixed in Axis2 1.3
-     */
-    private void setPortAddress(Definition definition, String requestIP, AxisService axisService) throws AxisFault {
-        Iterator serviceItr = definition.getServices().values().iterator();
-        while (serviceItr.hasNext()) {
-            Service serviceElement = (Service) serviceItr.next();
-            Iterator portItr = serviceElement.getPorts().values().iterator();
-            while (portItr.hasNext()) {
-                Port port = (Port) portItr.next();
-                List list = port.getExtensibilityElements();
-                for (int i = 0; i < list.size(); i++) {
-                    Object extensibilityEle = list.get(i);
-                    String locationURI = null;
-                    if (requestIP == null) {
-                        locationURI = axisService.getEPRs()[0];
-                    } else {
-// can't do this as the method's not visible, but Tuscany doesn't use this path anyway
-//                         locationURI = axisService.getEPRs(requestIP)[0]);
-                    }
-                    if (extensibilityEle instanceof SOAPAddress) {
-                        ((SOAPAddress) extensibilityEle).setLocationURI(locationURI);
-                    } else if (extensibilityEle instanceof SOAP12Address) {
-                        ((SOAP12Address) extensibilityEle).setLocationURI(locationURI);
-                    }
-                }
-            }
-        }
-    }
-    
 }

Copied: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java (from r670360, tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCaseFIXME.java)
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java?p2=tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java&p1=tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCaseFIXME.java&r1=670360&r2=670410&rev=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCaseFIXME.java (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java Sun Jun 22 13:26:27 2008
@@ -19,6 +19,10 @@
 
 package org.apache.tuscany.sca.binding.ws.axis2.itests;
 
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
 import java.util.List;
 
 import javax.wsdl.Definition;
@@ -39,7 +43,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class QuestionMarkWSDLImportTestCaseFIXME extends TestCase {
+public class QuestionMarkWSDLImportTestCase extends TestCase {
 
     private SCADomain domain;
 
@@ -47,13 +51,21 @@
      * Tests ?wsdl works and returns the correct port endpoint from the WSDL
      */
     public void testWSDLImportPortEndpoint() throws Exception {
+        InputStream inp = new URL("http://localhost:8086/AccountService?wsdl").openStream();
+        BufferedReader br = new BufferedReader(new InputStreamReader(inp));
+        String line;
+        while((line = br.readLine()) != null) {
+            System.out.println(line);
+        }
+        br.close();
+
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose", false);
         wsdlReader.setFeature("javax.wsdl.importDocuments", true);
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8086/AccountService?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://account2", "AccountService"));
+        Service service = definition.getService(new QName("http://account2/AccountService/$promoted$.ep1", "AccountService"));
         Port port = service.getPort("AccountSoapPort");
 
         String endpoint = getEndpoint(port);

Copied: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java (from r670360, tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java)
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java?p2=tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java&p1=tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java&r1=670360&r2=670410&rev=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCase.java Sun Jun 22 13:26:27 2008
@@ -19,6 +19,10 @@
 
 package org.apache.tuscany.sca.binding.ws.axis2.itests;
 
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
 import java.util.List;
 
 import javax.wsdl.Definition;
@@ -39,7 +43,7 @@
  *
  * @version $Rev: 660340 $ $Date: 2008-05-27 01:08:32 +0100 (Tue, 27 May 2008) $
  */
-public class QuestionMarkWSDLIncludeTestCaseFIXME extends TestCase {
+public class QuestionMarkWSDLIncludeTestCase extends TestCase {
 
     private SCADomain domain;
 
@@ -47,13 +51,21 @@
      * Tests ?wsdl works and returns the correct port endpoint from the WSDL
      */
     public void testWSDLIncludePortEndpoint() throws Exception {
+        InputStream inp = new URL("http://localhost:8085/AccountService?wsdl").openStream();
+        BufferedReader br = new BufferedReader(new InputStreamReader(inp));
+        String line;
+        while((line = br.readLine()) != null) {
+            System.out.println(line);
+        }
+        br.close();
+
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose", false);
         wsdlReader.setFeature("javax.wsdl.importDocuments", true);
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/AccountService?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName("http://accounts", "AccountService"));
+        Service service = definition.getService(new QName("http://accounts/AccountService/$promoted$.ep1", "AccountService"));
         Port port = service.getPort("AccountSoapPort");
 
         String endpoint = getEndpoint(port);

Modified: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java Sun Jun 22 13:26:27 2008
@@ -45,7 +45,6 @@
  */
 public class QuestionMarkWSDLTestCase extends TestCase {
 
-    private static boolean newGenerator = true;
     private SCADomain domain;
 
     /**
@@ -59,6 +58,7 @@
             System.out.println(line);
         }
         br.close();
+
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose",false);
         wsdlReader.setFeature("javax.wsdl.importDocuments",true);
@@ -85,16 +85,16 @@
             System.out.println(line);
         }
         br.close();
+
         WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
         wsdlReader.setFeature("javax.wsdl.verbose",false);
         wsdlReader.setFeature("javax.wsdl.importDocuments",true);
 
         Definition definition = wsdlReader.readWSDL("http://localhost:8085/foo/bar?wsdl");
         assertNotNull(definition);
-        Service service = definition.getService(new QName(
-                              "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
-                              newGenerator ? "HelloWorldService" : "HelloWorld"));
-        Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
+        Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org/",
+                                                          "HelloWorldService"));
+        Port port = service.getPort("HelloWorldPort");
 
         String endpoint = getEndpoint(port);
         String ip = HttpUtils.getIpAddress();

Added: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd?rev=670410&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd (added)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd Sun Jun 22 13:26:27 2008
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<xsd:schema elementFormDefault="qualified"
+            targetNamespace="http://accounts"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <xsd:include schemaLocation="customerdata.xsd" />
+    <xsd:include schemaLocation="/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd" />
+    
+</xsd:schema>

Added: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd?rev=670410&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd (added)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd Sun Jun 22 13:26:27 2008
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<xsd:schema elementFormDefault="qualified"
+            targetNamespace="http://accounts"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <xsd:complexType name="CustomerProfileInfo">
+        <xsd:sequence>
+            <xsd:element name="firstName" type="xsd:string" />
+            <xsd:element name="lastName" type="xsd:string" />
+        </xsd:sequence>
+    </xsd:complexType>
+    
+</xsd:schema>

Added: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl?rev=670410&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl (added)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl Sun Jun 22 13:26:27 2008
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<wsdl:definitions targetNamespace="http://account3"
+                  xmlns:tns="http://account3"
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	              name="questionmark-import-nested">
+
+    <wsdl:types>
+        <xsd:schema elementFormDefault="qualified"
+                    targetNamespace="http://account3"
+                    xmlns:account="http://accounts"
+                    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+            <xsd:import namespace="http://accounts" schemaLocation="customerdefs.xsd" />
+
+            <xsd:element name="getCustomerProfile">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="loginID" type="xsd:string" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+            <xsd:element name="getCustomerProfileResponse">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="customerProfile"
+                            type="account:CustomerProfileData" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+            
+        </xsd:schema>
+    </wsdl:types>
+
+    <wsdl:message name="getCustomerProfileRequest">
+        <wsdl:part element="tns:getCustomerProfile" name="parameters" />
+    </wsdl:message>
+
+    <wsdl:message name="getCustomerProfileResponse">
+        <wsdl:part element="tns:getCustomerProfileResponse" name="parameters" />
+    </wsdl:message>
+
+    <wsdl:portType name="Account">
+        <wsdl:operation name="getCustomerProfile">
+            <wsdl:input message="tns:getCustomerProfileRequest" name="getCustomerProfileRequest" />
+            <wsdl:output message="tns:getCustomerProfileResponse" name="getCustomerProfileResponse" />
+        </wsdl:operation>
+    </wsdl:portType>
+
+</wsdl:definitions>

Modified: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl Sun Jun 22 13:26:27 2008
@@ -1,90 +1,49 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.    
--->
-<wsdl:definitions targetNamespace="http://account2"
-                  xmlns:tns="http://account2"
-                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
-                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
-                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-	              name="questionmark-include">
-
-    <wsdl:types>
-        <xsd:schema elementFormDefault="qualified"
-                    targetNamespace="http://account2"
-                    xmlns:account="http://accounts"
-                    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
-            <xsd:import namespace="http://accounts" schemaLocation="customerdata.xsd" />
-
-            <xsd:element name="getCustomerProfile">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="loginID" type="xsd:string" />
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-
-            <xsd:element name="getCustomerProfileResponse">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="customerProfile"
-                            type="account:CustomerProfileData" />
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-            
-        </xsd:schema>
-    </wsdl:types>
-
-    <wsdl:message name="getCustomerProfileRequest">
-        <wsdl:part element="tns:getCustomerProfile" name="parameters" />
-    </wsdl:message>
-
-    <wsdl:message name="getCustomerProfileResponse">
-        <wsdl:part element="tns:getCustomerProfileResponse" name="parameters" />
-    </wsdl:message>
-
-    <wsdl:portType name="Account">
-        <wsdl:operation name="getCustomerProfile">
-            <wsdl:input message="tns:getCustomerProfileRequest" name="getCustomerProfileRequest" />
-            <wsdl:output message="tns:getCustomerProfileResponse" name="getCustomerProfileResponse" />
-        </wsdl:operation>
-    </wsdl:portType>
-
-    <wsdl:binding name="AccountSoapBinding" type="tns:Account">
-        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
-        <wsdl:operation name="getCustomerProfile">
-            <wsdlsoap:operation soapAction="" />
-            <wsdl:input name="getCustomerProfileRequest">
-                <wsdlsoap:body use="literal" />
-            </wsdl:input>
-            <wsdl:output name="getCustomerProfileResponse">
-                <wsdlsoap:body use="literal" />
-            </wsdl:output>
-        </wsdl:operation>
-
-    </wsdl:binding>
-
-    <wsdl:service name="AccountService">
-        <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
-            <wsdlsoap:address location="http://localhost:8086/AccountService" />
-        </wsdl:port>
-    </wsdl:service>
-
-</wsdl:definitions>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<wsdl:definitions targetNamespace="http://account2"
+                  xmlns:tns="http://account2"
+                  xmlns:account3="http://account3"
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	              name="questionmark-import">
+
+    <wsdl:import namespace="http://account3" location="/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl" />
+
+    <wsdl:binding name="AccountSoapBinding" type="account3:Account">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="getCustomerProfile">
+            <wsdlsoap:operation soapAction="" />
+            <wsdl:input name="getCustomerProfileRequest">
+                <wsdlsoap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output name="getCustomerProfileResponse">
+                <wsdlsoap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="AccountService">
+        <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
+            <wsdlsoap:address location="http://localhost:8086/AccountService" />
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>

Modified: tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl (original)
+++ tuscany/branches/sca-java-1.3/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl Sun Jun 22 13:26:27 2008
@@ -1,90 +1,94 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.    
--->
-<wsdl:definitions targetNamespace="http://accounts"
-                  xmlns:tns="http://accounts"
-                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
-                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
-                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
-	              name="questionmark-include">
-
-    <wsdl:types>
-        <xsd:schema elementFormDefault="qualified"
-                    targetNamespace="http://accounts"
-                    xmlns:account="http://accounts"
-                    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
-            <xsd:include schemaLocation="customerdata.xsd" />
-
-            <xsd:element name="getCustomerProfile">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="loginID" type="xsd:string" />
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-
-            <xsd:element name="getCustomerProfileResponse">
-                <xsd:complexType>
-                    <xsd:sequence>
-                        <xsd:element name="customerProfile"
-                            type="account:CustomerProfileData" />
-                    </xsd:sequence>
-                </xsd:complexType>
-            </xsd:element>
-            
-        </xsd:schema>
-    </wsdl:types>
-
-    <wsdl:message name="getCustomerProfileRequest">
-        <wsdl:part element="tns:getCustomerProfile" name="parameters" />
-    </wsdl:message>
-
-    <wsdl:message name="getCustomerProfileResponse">
-        <wsdl:part element="tns:getCustomerProfileResponse" name="parameters" />
-    </wsdl:message>
-
-    <wsdl:portType name="Account">
-        <wsdl:operation name="getCustomerProfile">
-            <wsdl:input message="tns:getCustomerProfileRequest" name="getCustomerProfileRequest" />
-            <wsdl:output message="tns:getCustomerProfileResponse" name="getCustomerProfileResponse" />
-        </wsdl:operation>
-    </wsdl:portType>
-
-    <wsdl:binding name="AccountSoapBinding" type="tns:Account">
-        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
-        <wsdl:operation name="getCustomerProfile">
-            <wsdlsoap:operation soapAction="" />
-            <wsdl:input name="getCustomerProfileRequest">
-                <wsdlsoap:body use="literal" />
-            </wsdl:input>
-            <wsdl:output name="getCustomerProfileResponse">
-                <wsdlsoap:body use="literal" />
-            </wsdl:output>
-        </wsdl:operation>
-
-    </wsdl:binding>
-
-    <wsdl:service name="AccountService">
-        <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
-            <wsdlsoap:address location="http://localhost:8085/AccountService" />
-        </wsdl:port>
-    </wsdl:service>
-
-</wsdl:definitions>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.    
+-->
+<wsdl:definitions targetNamespace="http://accounts"
+                  xmlns:tns="http://accounts"
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	              name="questionmark-include">
+
+    <wsdl:types>
+        <xsd:schema elementFormDefault="qualified"
+                    targetNamespace="http://accounts"
+                    xmlns:account="http://accounts"
+                    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+            <xsd:include schemaLocation="/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdata.xsd" />
+
+            <xsd:element name="getCustomerProfile">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="loginID" type="xsd:string" />
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+            <xsd:element name="getCustomerProfileResponse">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="customerProfile"
+                            type="xsd:string" />
+                        <!--
+                        <xsd:element name="customerProfile"
+                            type="account:CustomerProfileData" />
+                        -->
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+            
+        </xsd:schema>
+    </wsdl:types>
+
+    <wsdl:message name="getCustomerProfileRequest">
+        <wsdl:part element="tns:getCustomerProfile" name="parameters" />
+    </wsdl:message>
+
+    <wsdl:message name="getCustomerProfileResponse">
+        <wsdl:part element="tns:getCustomerProfileResponse" name="parameters" />
+    </wsdl:message>
+
+    <wsdl:portType name="Account">
+        <wsdl:operation name="getCustomerProfile">
+            <wsdl:input message="tns:getCustomerProfileRequest" name="getCustomerProfileRequest" />
+            <wsdl:output message="tns:getCustomerProfileResponse" name="getCustomerProfileResponse" />
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="AccountSoapBinding" type="tns:Account">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+        <wsdl:operation name="getCustomerProfile">
+            <wsdlsoap:operation soapAction="" />
+            <wsdl:input name="getCustomerProfileRequest">
+                <wsdlsoap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output name="getCustomerProfileResponse">
+                <wsdlsoap:body use="literal" />
+            </wsdl:output>
+        </wsdl:operation>
+
+    </wsdl:binding>
+
+    <wsdl:service name="AccountService">
+        <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
+            <wsdlsoap:address location="http://localhost:8085/AccountService" />
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>

Modified: tuscany/branches/sca-java-1.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java (original)
+++ tuscany/branches/sca-java-1.3/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java Sun Jun 22 13:26:27 2008
@@ -282,6 +282,9 @@
 
         // Lookup a definition for the given namespace
         String namespace = ((WSDLDefinition)unresolved).getNamespace();
+        if (namespace == null) {
+            return modelClass.cast(unresolved);
+        }
         List<WSDLDefinition> list = map.get(namespace);
         WSDLDefinition resolved = aggregate(list);
         if (resolved != null && !resolved.isUnresolved()) {
@@ -352,12 +355,40 @@
             reader.setFeature("javax.wsdl.importDocuments", true);
             // FIXME: We need to decide if we should disable the import processing by WSDL4J
             // reader.setFeature("javax.wsdl.importDocuments", false);
-            reader.setExtensionRegistry(wsdlExtensionRegistry);
+            reader.setExtensionRegistry(wsdlExtensionRegistry);  // use a custom registry
 
             WSDLLocatorImpl locator = new WSDLLocatorImpl(artifactURL, is);
             Definition definition = reader.readWSDL(locator);
             wsdlDef.setDefinition(definition);
 
+            // If this definition imports any definitions from other namespaces,
+            // set the correct WSDLDefinition import relationships.
+            for (Map.Entry<String, List<javax.wsdl.Import>> entry :
+                    ((Map<String, List<javax.wsdl.Import>>)definition.getImports()).entrySet()) {
+                if (!entry.getKey().equals(definition.getTargetNamespace())) { 
+                    WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
+                    wsdlDefinition.setUnresolved(true);
+                    wsdlDefinition.setNamespace(entry.getKey());
+                    WSDLDefinition resolved = resolveModel(WSDLDefinition.class, wsdlDefinition);
+                    if (!resolved.isUnresolved()) {
+                        for (javax.wsdl.Import imp : entry.getValue()) {
+                            if (resolved.getDefinition().getDocumentBaseURI().equals(imp.getDefinition().getDocumentBaseURI())) {
+                                // this WSDLDefinition contains the imported document
+                                wsdlDef.getImportedDefinitions().add(resolved);
+                            } else {
+                                // this is a facade, so look in its imported definitions
+                                for (WSDLDefinition def : resolved.getImportedDefinitions()) {
+                                    if (def.getDefinition().getDocumentBaseURI().equals(imp.getDefinition().getDocumentBaseURI())) {
+                                        wsdlDef.getImportedDefinitions().add(def);
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
             //Read inline schemas 
             readInlineSchemas(wsdlDef, definition);
         } catch (WSDLException e) {
@@ -427,6 +458,9 @@
                         contribution.getModelResolver().resolveModel(XSDefinition.class, xsDefinition);
                     if (resolved != null && !resolved.isUnresolved()) {
                         if (!wsdlDefinition.getXmlSchemas().contains(resolved)) {
+                            // Don't add resolved because it may be an aggregate that
+                            // contains more than we need.  The resolver will have
+                            // set the specific schema we need into unresolved.
                             wsdlDefinition.getXmlSchemas().add(xsDefinition);
                         }
                     }

Modified: tuscany/branches/sca-java-1.3/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.3/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java?rev=670410&r1=670409&r2=670410&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.3/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java (original)
+++ tuscany/branches/sca-java-1.3/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java Sun Jun 22 13:26:27 2008
@@ -87,11 +87,13 @@
         // Lookup a definition for the given namespace
         String namespace = definition.getNamespace();
         List<XSDefinition> list = map.get(namespace);
+        XSDefinition modelXSD = null;
         if (list != null && definition.getDocument() != null) {
             // Set the document for the inline schema
             int index = list.indexOf(definition);
-            if (index != -1) {
-                list.get(index).setDocument(definition.getDocument());
+            if (index != -1) {  // a matching (not identical) document was found
+                modelXSD = list.get(index);
+                modelXSD.setDocument(definition.getDocument());
             }
         }
         if (list == null && definition.getDocument() != null) {
@@ -107,6 +109,14 @@
             throw new ContributionRuntimeException(e);
         }
         if (resolved != null && !resolved.isUnresolved()) {
+            if (definition.isUnresolved() && definition.getSchema() == null && modelXSD != null) {
+                // Update the unresolved model with schema information and mark it
+                // resolved.  This information in the unresolved model is needed when
+                // this method is called by WSDLModelResolver.readInlineSchemas().
+                definition.setSchema(modelXSD.getSchema());
+                definition.setSchemaCollection(modelXSD.getSchemaCollection());
+                definition.setUnresolved(false);
+            }
             return modelClass.cast(resolved);
         }
 
@@ -221,7 +231,7 @@
                                                      java.lang.String schemaLocation,
                                                      java.lang.String baseUri) {
             try {
-                if (schemaLocation == null || schemaLocation.startsWith("/")) {
+                if (schemaLocation == null) {
                     return null;
                 }
                 URL url = null;