cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1232579 - in /cxf/branches/2.4.x-fixes: ./ common/common/src/main/java/org/apache/cxf/jaxb/ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/ systests/databinding/src/test/java/org/apache/cxf/systest/aegis/ systests/transp...
Date Tue, 17 Jan 2012 21:24:44 GMT
Author: dkulp
Date: Tue Jan 17 21:24:44 2012
New Revision: 1232579

URL: http://svn.apache.org/viewvc?rev=1232579&view=rev
Log:
Merged revisions 1232569 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

................
  r1232569 | dkulp | 2012-01-17 15:49:11 -0500 (Tue, 17 Jan 2012) | 10 lines
  
  Merged revisions 1232564 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1232564 | dkulp | 2012-01-17 15:37:31 -0500 (Tue, 17 Jan 2012) | 2 lines
    
    [CXF-4037] Allow dynamic client to use already parsed and processed
    schemas like the tooling does.
  ........
................

Added:
    cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_types.xsd
      - copied unchanged from r1232569, cxf/branches/2.5.x-fixes/testutils/src/main/resources/wsdl/hello_world_types.xsd
    cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_types_include.xsd
      - copied unchanged from r1232569, cxf/branches/2.5.x-fixes/testutils/src/main/resources/wsdl/hello_world_types_include.xsd
Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
    cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
    cxf/branches/2.4.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
    cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
    cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
    cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_messages.wsdl.xml

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java?rev=1232579&r1=1232578&r2=1232579&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
(original)
+++ cxf/branches/2.4.x-fixes/common/common/src/main/java/org/apache/cxf/jaxb/JAXBUtils.java
Tue Jan 17 21:24:44 2012
@@ -954,6 +954,7 @@ public final class JAXBUtils {
         void parseSchema(InputSource source);
 
         void parseSchema(String key, Element el);
+        void parseSchema(String key, XMLStreamReader el);
 
         @WrapReturn(Options.class)
         Options getOptions();

Modified: cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=1232579&r1=1232578&r2=1232579&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Tue Jan 17 21:24:44 2012
@@ -23,15 +23,18 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLDecoder;
-import java.util.Collection;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -41,35 +44,55 @@ import java.util.jar.JarFile;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.xml.XMLConstants;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.StreamReaderDelegate;
 
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
 
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+import com.sun.tools.xjc.ErrorReceiver;
+import com.sun.tools.xjc.reader.internalizer.AbstractReferenceFinderImpl;
+import com.sun.tools.xjc.reader.internalizer.DOMForest;
+import com.sun.tools.xjc.reader.xmlschema.parser.XMLSchemaInternalizationLogic;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.CXFBusFactory;
+import org.apache.cxf.catalog.OASISCatalogManager;
+import org.apache.cxf.catalog.OASISCatalogManagerHelper;
+import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ReflectionInvokationHandler;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientImpl;
 import org.apache.cxf.endpoint.EndpointImplFactory;
 import org.apache.cxf.endpoint.SimpleEndpointImplFactory;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxb.JAXBUtils;
 import org.apache.cxf.jaxb.JAXBUtils.JCodeModel;
 import org.apache.cxf.jaxb.JAXBUtils.JDefinedClass;
 import org.apache.cxf.jaxb.JAXBUtils.JPackage;
+import org.apache.cxf.jaxb.JAXBUtils.Options;
 import org.apache.cxf.jaxb.JAXBUtils.S2JJAXBModel;
 import org.apache.cxf.jaxb.JAXBUtils.SchemaCompiler;
 import org.apache.cxf.resource.URIResolver;
@@ -79,6 +102,9 @@ import org.apache.cxf.service.model.Sche
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaSerializer;
+import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
 /**
  * This class reads a WSDL and creates a dynamic client from it.
  * 
@@ -269,7 +295,7 @@ public class DynamicClientFactory {
                                            getEndpointImplFactory());
 
         //all SI's should have the same schemas
-        Collection<SchemaInfo> schemas = svc.getServiceInfos().get(0).getSchemas();
+        SchemaCollection schemas = svc.getServiceInfos().get(0).getXmlSchemaCollection();
 
         SchemaCompiler compiler = 
             JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<String>());
@@ -281,7 +307,10 @@ public class DynamicClientFactory {
         
         compiler.setErrorListener(elForRun);
         
-        addSchemas(wsdlUrl, schemas, compiler);
+        OASISCatalogManager catalog = bus.getExtension(OASISCatalogManager.class);
+        hackInNewInternalizationLogic(compiler, catalog);
+
+        addSchemas(compiler.getOptions(), compiler, svc.getServiceInfos(), schemas);
         addBindingFiles(bindingFiles, compiler);
         S2JJAXBModel intermediateModel = compiler.bind();
         
@@ -421,34 +450,117 @@ public class DynamicClientFactory {
         return false;
     }
 
-    private void addSchemas(String wsdlUrl, Collection<SchemaInfo> schemas, SchemaCompiler
compiler) {
-        int num = 1;
-        for (SchemaInfo schema : schemas) {
-            Element el = schema.getElement();
-            String key = schema.getSystemId();
-            if (StringUtils.isEmpty(key)) {
-                key = wsdlUrl + "#types" + num;
+    
+    private void addSchemas(Options opts,
+                            SchemaCompiler schemaCompiler,
+                            List<ServiceInfo> serviceList,
+                            SchemaCollection schemaCollection) {
+
+        Map<String, Element> done = new HashMap<String, Element>();
+        Map<String, Element> notDone = new HashMap<String, Element>();
+        OASISCatalogManager catalog = bus.getExtension(OASISCatalogManager.class);
+        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
+            if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schema.getTargetNamespace())) {
+                continue;
             }
+            String key = schema.getSourceURI();
+            if (done.containsKey(key)) {
+                continue;
+            }
+            if (!key.startsWith("file:") && !key.startsWith("jar:")) {
+                XmlSchemaSerializer xser = new XmlSchemaSerializer();
+                xser.setExtReg(schemaCollection.getExtReg());
+                Document[] docs;
+                try {
+                    docs = xser.serializeSchema(schema, false);
+                } catch (XmlSchemaSerializerException e) {
+                    throw new RuntimeException(e);
+                }
+                Element ele = docs[0].getDocumentElement();
+                ele = removeImportElement(ele, key, catalog, done, notDone);
+                try {
+                    docs[0].setDocumentURI(key);
+                } catch (Throwable t) {
+                    //ignore - DOM level 3
+                }
+                if (ele != null) {
+                    InputSource is = new InputSource((InputStream)null);
+                    //key = key.replaceFirst("#types[0-9]+$", "");
+                    is.setSystemId(key);
+                    is.setPublicId(key);
+                    opts.addGrammar(is);
+                    schemaCompiler.parseSchema(key, ele);
+                }
+            }
+        }
+        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
+            if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(schema.getTargetNamespace())) {
+                continue;
+            }
+            String key = schema.getSourceURI();
+            if (done.containsKey(key)) {
+                continue;
+            }
+            if (key.startsWith("file:") || key.startsWith("jar:")) {
+                InputStream in = null;
+                try {
+                    if (key.startsWith("file:")) {
+                        in = new FileInputStream(new File(new URI(key)));
+                    } else {
+                        in = new URL(key).openStream();
+                    }
 
-            //For JAXB 2.1.8
-            InputSource is = new InputSource((InputStream)null);
-            is.setSystemId(key);
-            is.setPublicId(key);
-            compiler.getOptions().addGrammar(is);
-
-            compiler.parseSchema(key, el);
-            num++;
-        }
-        if (simpleBindingEnabled) {
-            String id = "/org/apache/cxf/endpoint/dynamic/simple-binding.xjb";
-            LOG.fine("Loading the JAXB 2.1 simple binding for client.");
-            try {
-                Document doc = StaxUtils.read(getClass().getResourceAsStream(id));
-                compiler.parseSchema(id, doc.getDocumentElement());
-            } catch (XMLStreamException e) {
-                LOG.log(Level.WARNING, "Could not parse simple-binding.xsd", e);
+                    XMLStreamReader reader = StaxUtils.createXMLStreamReader(key, in);
+                    reader = new LocationFilterReader(reader, catalog);
+                    InputSource is = new InputSource(key);
+                    opts.addGrammar(is);
+                    schemaCompiler.parseSchema(key, reader);
+                    reader.close();
+                } catch (RuntimeException ex) {
+                    throw ex;
+                } catch (Exception ex) {
+                    throw new RuntimeException(ex);
+                } finally {
+                    if (in != null) {
+                        try {
+                            in.close();
+                        } catch (IOException e) {
+                            //ignore
+                        }
+                    }
+                }
             }
         }
+        for (ServiceInfo si : serviceList) {
+            for (SchemaInfo sci : si.getSchemas()) {
+                String key = sci.getSystemId();
+                if (done.containsKey(key)) {
+                    continue;
+                }
+                Element ele = sci.getElement();
+                ele = removeImportElement(ele, key, catalog, done, notDone);
+                if (ele != null) {
+                    InputSource is = new InputSource((InputStream)null);
+                    //key = key.replaceFirst("#types[0-9]+$", "");
+                    is.setSystemId(key);
+                    is.setPublicId(key);
+                    opts.addGrammar(is);
+                    schemaCompiler.parseSchema(key, StaxUtils.createXMLStreamReader(ele,
key));
+                }
+            }
+        }
+        for (Map.Entry<String, Element> el : notDone.entrySet()) {
+            InputSource is = new InputSource((InputStream)null);
+            //key = key.replaceFirst("#types[0-9]+$", "");
+            is.setSystemId(el.getKey());
+            is.setPublicId(el.getKey());
+            opts.addGrammar(is);
+            schemaCompiler.parseSchema(el.getKey(),
+                                       StaxUtils.createXMLStreamReader(el.getValue(),
+                                                                       el.getKey()));
+
+        }
+
     }
     
     public boolean isSimpleBindingEnabled() {
@@ -660,4 +772,280 @@ public class DynamicClientFactory {
         this.jaxbContextProperties = jaxbContextProperties;
     }
     
+    
+    private void hackInNewInternalizationLogic(SchemaCompiler schemaCompiler,
+                                               final OASISCatalogManager catalog) {
+        try {
+            Object o = ((ReflectionInvokationHandler)Proxy.getInvocationHandler(schemaCompiler)).getTarget();
+            Field f = o.getClass().getDeclaredField("forest");
+            f.setAccessible(true);
+            DOMForest forest = new DOMForest(new XMLSchemaInternalizationLogic() {
+                public XMLFilterImpl createExternalReferenceFinder(DOMForest parent) {
+                    return new ReferenceFinder(parent, catalog);
+                }
+
+            });
+            forest.setErrorHandler((ErrorReceiver)o);
+            f.set(o, forest);
+        } catch (Throwable ex)  {
+            //ignore
+        }
+    }
+    
+    private static final class ReferenceFinder extends AbstractReferenceFinderImpl {
+        private Locator locator;
+        private OASISCatalogManager catalog;
+
+        ReferenceFinder(DOMForest parent, OASISCatalogManager cat) {
+            super(parent);
+            catalog = cat;
+        }
+
+        public void setDocumentLocator(Locator loc) {
+            super.setDocumentLocator(loc);
+            this.locator = loc;
+        }
+        protected String findExternalResource(String nsURI, String localName, org.xml.sax.Attributes
atts) {
+            if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(nsURI)
+                && ("import".equals(localName)
+                    || "include".equals(localName))) {
+                String s = atts.getValue("schemaLocation");
+                if (!StringUtils.isEmpty(s)) {
+                    s = mapSchemaLocation(s, locator.getSystemId(), catalog);
+                }
+                return s;
+            }
+            return null;
+        }
+    }
+    static String mapSchemaLocation(String target, String base, OASISCatalogManager catalog)
{
+        try {
+            String resolvedLocation = new OASISCatalogManagerHelper().resolve(catalog, 
+                                                                              target, base);
+            if (resolvedLocation != null) {
+                return resolvedLocation;
+            }
+
+        } catch (Exception ex) {
+            //ignore
+        }
+        
+
+        try {
+            URIResolver resolver = new URIResolver(base, target);
+            if (resolver.isResolved()) {
+                target = resolver.getURI().toString();
+            }
+        } catch (Exception ex) {
+            //ignore
+        }
+        return target;
+    }
+    private Element removeImportElement(Element element,
+                                        String sysId,
+                                        OASISCatalogManager catalog,
+                                        Map<String, Element> done,
+                                        Map<String, Element> notDone) {
+        List<Element> impElemList = DOMUtils.findAllElementsByTagNameNS(element,
+                                                                        "http://www.w3.org/2001/XMLSchema",
+                                                                     "import");
+        List<Element> incElemList = DOMUtils.findAllElementsByTagNameNS(element,
+                                                                        "http://www.w3.org/2001/XMLSchema",
+                                                                     "include");
+        if (impElemList.size() == 0 && incElemList.size() == 0) {
+            return element;
+        }
+        element = (Element)cloneNode(element.getOwnerDocument(), element, true);
+        List<Node> ns = new ArrayList<Node>();
+
+        impElemList = DOMUtils.findAllElementsByTagNameNS(element,
+                                                          "http://www.w3.org/2001/XMLSchema",
+                                                           "import");
+        for (Element elem : impElemList) {
+            Node importNode = elem;
+            ns.add(importNode);
+        }
+        for (Node item : ns) {
+            Node schemaNode = item.getParentNode();
+            schemaNode.removeChild(item);
+        }
+
+        incElemList = DOMUtils.findAllElementsByTagNameNS(element,
+                                                          "http://www.w3.org/2001/XMLSchema",
+                                                          "include");
+        
+        boolean addedToNotDone = false;
+        for (Element elem : incElemList) {
+            Attr val = elem.getAttributeNode("schemaLocation");
+            String s = mapSchemaLocation(val.getNodeValue(), sysId, catalog);
+            val.setNodeValue(s);
+            if (!done.containsKey(s)) {
+                notDone.put(sysId, element);
+                addedToNotDone = true;
+            }
+        }
+
+        return addedToNotDone ? null : element;
+    }
+
+    public Node cloneNode(Document document, Node node, boolean deep) throws DOMException
{
+        if (document == null || node == null) {
+            return null;
+        }
+        int type = node.getNodeType();
+
+        if (node.getOwnerDocument() == document) {
+            return node.cloneNode(deep);
+        }
+        Node clone;
+        switch (type) {
+        case Node.CDATA_SECTION_NODE:
+            clone = document.createCDATASection(node.getNodeValue());
+            break;
+        case Node.COMMENT_NODE:
+            clone = document.createComment(node.getNodeValue());
+            break;
+        case Node.ENTITY_REFERENCE_NODE:
+            clone = document.createEntityReference(node.getNodeName());
+            break;
+        case Node.ELEMENT_NODE:
+            clone = document.createElement(node.getNodeName());
+            NamedNodeMap attributes = node.getAttributes();
+            for (int i = 0; i < attributes.getLength(); i++) {
+                ((Element)clone).setAttribute(attributes.item(i).getNodeName(), attributes.item(i)
+                    .getNodeValue());
+            }
+            break;
+
+        case Node.TEXT_NODE:
+            clone = document.createTextNode(node.getNodeValue());
+            break;
+        default:
+            return null;
+        }
+        if (deep && type == Node.ELEMENT_NODE) {
+            Node child = node.getFirstChild();
+            while (child != null) {
+                clone.appendChild(cloneNode(document, child, true));
+                child = child.getNextSibling();
+            }
+        }
+        return clone;
+    }
+    public class LocationFilterReader extends StreamReaderDelegate implements XMLStreamReader
{
+        boolean isImport;
+        boolean isInclude;
+        int locIdx = -1;
+        OASISCatalogManager catalog;
+
+        LocationFilterReader(XMLStreamReader read, OASISCatalogManager catalog) {
+            super(read);
+            this.catalog = catalog;
+        }
+
+        public int next() throws XMLStreamException {
+            int i = super.next();
+            if (i == XMLStreamReader.START_ELEMENT) {
+                QName qn = super.getName();
+                isInclude = qn.equals(WSDLConstants.QNAME_SCHEMA_INCLUDE);
+                isImport = qn.equals(WSDLConstants.QNAME_SCHEMA_IMPORT);
+                if (isImport) {
+                    findLocation();
+                } else {
+                    locIdx = -1;
+                }
+            } else {
+                isImport = false;
+                locIdx = -1;
+            }
+            return i;
+        }
+
+        public int nextTag() throws XMLStreamException {
+            int i = super.nextTag();
+            if (i == XMLStreamReader.START_ELEMENT) {
+                QName qn = super.getName();
+                isInclude = qn.equals(WSDLConstants.QNAME_SCHEMA_INCLUDE);
+                isImport = qn.equals(WSDLConstants.QNAME_SCHEMA_IMPORT);
+                if (isImport) {
+                    findLocation();
+                } else {
+                    locIdx = -1;
+                }
+            } else {
+                isImport = false;
+                locIdx = -1;
+            }
+            return i;
+        }
+        private void findLocation() {
+            locIdx = -1;
+            for (int x = super.getAttributeCount(); x > 0; --x) {
+                String nm = super.getAttributeLocalName(x - 1);
+                if ("schemaLocation".equals(nm)) {
+                    locIdx = x - 1;
+                }
+            }
+        }
+        public int getAttributeCount() {
+            int i = super.getAttributeCount();
+            if (locIdx != -1) {
+                --i;
+            }
+            return i;
+        }
+        private int mapIdx(int index) {
+            if (locIdx != -1
+                && index >= locIdx) {
+                ++index;
+            }
+            return index;
+        }
+
+        private String mapSchemaLocation(String target) {
+            return DynamicClientFactory.mapSchemaLocation(target, this.getLocation().getSystemId(),
catalog);
+        }
+
+        public String getAttributeValue(String namespaceURI, String localName) {
+            if (isInclude && "schemaLocation".equals(localName)) {
+                return mapSchemaLocation(super.getAttributeValue(namespaceURI, localName));
+            }
+            return super.getAttributeValue(namespaceURI, localName);
+        }
+        public String getAttributeValue(int index) {
+            if (isInclude) {
+                String n = getAttributeLocalName(index);
+                if ("schemaLocation".equals(n)) {
+                    return mapSchemaLocation(super.getAttributeValue(index));
+                }
+            }
+            return super.getAttributeValue(mapIdx(index));
+        }
+
+        public QName getAttributeName(int index) {
+            return super.getAttributeName(mapIdx(index));
+        }
+
+        public String getAttributePrefix(int index) {
+            return super.getAttributePrefix(mapIdx(index));
+        }
+
+        public String getAttributeNamespace(int index) {
+            return super.getAttributeNamespace(mapIdx(index));
+        }
+
+        public String getAttributeLocalName(int index) {
+            return super.getAttributeLocalName(mapIdx(index));
+        }
+
+        public String getAttributeType(int index) {
+            return super.getAttributeType(mapIdx(index));
+        }
+
+
+        public boolean isAttributeSpecified(int index) {
+            return super.isAttributeSpecified(mapIdx(index));
+        }
+    }
+
 }

Modified: cxf/branches/2.4.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java?rev=1232579&r1=1232578&r2=1232579&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
Tue Jan 17 21:24:44 2012
@@ -259,7 +259,7 @@ public class AegisClientServerTest exten
     @Test
     public void testDynamicClient() throws Exception {
         DynamicClientFactory dcf = DynamicClientFactory.newInstance();
-        Client client = dcf.createClient("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl");
+        Client client = dcf.createClient("http://localhost:" + PORT + "/jaxwsAndAegisSports?wsdl&dynamic");
 
         Object r = client.invoke("getAttributeBean")[0];
         Method getAddrPlainString = r.getClass().getMethod("getAttrPlainString");

Modified: cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java?rev=1232579&r1=1232578&r2=1232579&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
(original)
+++ cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/HTTPSClientTest.java
Tue Jan 17 21:24:44 2012
@@ -25,6 +25,7 @@ import javax.xml.ws.BindingProvider;
 
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.hello_world.Greeter;
 import org.apache.hello_world.services.SOAPService;
@@ -89,11 +90,28 @@ public class HTTPSClientTest extends Abs
     public final void testSuccessfulCall(String configuration,
                                          String address,
                                          URL url) throws Exception {
+        testSuccessfulCall(configuration, address, url, false);
+    }
+    public final void testSuccessfulCall(String configuration,
+                                         String address,
+                                         URL url, 
+                                         boolean dynamicClient) throws Exception {
         setTheConfiguration(configuration);
         startServers();
         if (url == null) {
             url = SOAPService.WSDL_LOCATION;
         }
+        
+        //CXF-4037 - dynamic client isn't using the conduit settings to resolve schemas
+        if (dynamicClient) {
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            JaxWsDynamicClientFactory.newInstance(BusFactory.getDefaultBus())
+                .createClient(url.toExternalForm());
+            Thread.currentThread().setContextClassLoader(loader);
+        }
+
+        
+        
         SOAPService service = new SOAPService(url, SOAPService.SERVICE);
         assertNotNull("Service is null", service);   
         final Greeter port = service.getHttpsPort();
@@ -105,6 +123,8 @@ public class HTTPSClientTest extends Abs
               address);
         
         assertEquals(port.greetMe("Kitty"), "Hello Kitty");
+        
+        
         stopServers();
     }
     
@@ -139,6 +159,8 @@ public class HTTPSClientTest extends Abs
     public final void testResourceKeySpecEndpointURL() throws Exception {
         testSuccessfulCall("resources/resource-key-spec-url.xml",
                            "https://localhost:" + PORT5 + "/SoapContext/HttpsPort",
-                           new URL("https://localhost:" + PORT5 + "/SoapContext/HttpsPort?wsdl"));
+                           new URL("https://localhost:" + PORT5 + "/SoapContext/HttpsPort?wsdl"),
+                           true);
+        
     }
 }

Modified: cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml?rev=1232579&r1=1232578&r2=1232579&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
(original)
+++ cxf/branches/2.4.x-fixes/systests/transports/src/test/java/org/apache/cxf/systest/http/resources/resource-key-spec-url.xml
Tue Jan 17 21:24:44 2012
@@ -22,9 +22,11 @@ under the License.
        xmlns:http="http://cxf.apache.org/transports/http/configuration"
        xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xmlns:cxf="http://cxf.apache.org/core"
        xmlns:sec="http://cxf.apache.org/configuration/security"
        xsi:schemaLocation="
         http://www.springframework.org/schema/beans                 http://www.springframework.org/schema/beans/spring-beans.xsd
+        http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
         http://cxf.apache.org/jaxws                                 http://cxf.apache.org/schemas/jaxws.xsd
         http://cxf.apache.org/transports/http/configuration         http://cxf.apache.org/schemas/configuration/http-conf.xsd
         http://cxf.apache.org/transports/http-jetty/configuration   http://cxf.apache.org/schemas/configuration/http-jetty.xsd
@@ -52,9 +54,14 @@ under the License.
         address="https://localhost:${testutil.ports.BusServer.5}/SoapContext/HttpsPort"
         serviceName="s:SOAPService"
         endpointName="e:HttpsPort"
+        wsdlLocation="/wsdl/hello_world_services.wsdl"
         xmlns:e="http://apache.org/hello_world/services"
         xmlns:s="http://apache.org/hello_world/services"
-        depends-on="port-9005-tls-config"/>
+        depends-on="port-9005-tls-config">
+        <jaxws:features>
+            <cxf:logging/>
+        </jaxws:features>
+    </jaxws:endpoint>
 
     <!-- -->
     <!-- TLS Port configuration parameters for port 9005 -->

Modified: cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_messages.wsdl.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_messages.wsdl.xml?rev=1232579&r1=1232578&r2=1232579&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_messages.wsdl.xml
(original)
+++ cxf/branches/2.4.x-fixes/testutils/src/main/resources/wsdl/hello_world_messages.wsdl.xml
Tue Jan 17 21:24:44 2012
@@ -27,48 +27,8 @@
     targetNamespace="http://apache.org/hello_world/messages">
     <wsdl:types>
         <schema
-            xmlns="http://www.w3.org/2001/XMLSchema"
-            xmlns:x1="http://apache.org/hello_world/types"
-            targetNamespace="http://apache.org/hello_world/types"
-            elementFormDefault="qualified">
-            <element name="sayHi">
-                <complexType/>
-            </element>
-            <element name="sayHiResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMe">
-                <complexType>
-                    <sequence>
-                        <element name="requestType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="greetMeResponse">
-                <complexType>
-                    <sequence>
-                        <element name="responseType" type="string"/>
-                    </sequence>
-                </complexType>
-            </element>
-            <element name="pingMe">
-                <complexType/>
-            </element>
-            <element name="pingMeResponse">
-                <complexType/>
-            </element>
-            <element name="faultDetail">
-                <complexType>
-                    <sequence>
-                        <element name="minor" type="short" form="qualified" minOccurs="0"/>
-                        <element name="major" type="short" form="qualified" minOccurs="0"/>
-                    </sequence>
-                </complexType>
-            </element>
+            xmlns="http://www.w3.org/2001/XMLSchema">
+            <import namespace="http://apache.org/hello_world/types" schemaLocation="hello_world_types.xsd"/>
         </schema>
     </wsdl:types>
     <wsdl:message name="sayHiRequest">



Mime
View raw message