You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/08/24 23:27:36 UTC

svn commit: r1161285 [1/2] - in /cxf/trunk/rt: frontend/simple/src/main/java/org/apache/cxf/frontend/ ws/mex/ ws/mex/src/ ws/mex/src/main/ ws/mex/src/main/java/ ws/mex/src/main/java/org/ ws/mex/src/main/java/org/apache/ ws/mex/src/main/java/org/apache/...

Author: dkulp
Date: Wed Aug 24 21:27:35 2011
New Revision: 1161285

URL: http://svn.apache.org/viewvc?rev=1161285&view=rev
Log:
Start of implementing server side ws-mex.
Basic query for wsdl is working.
Schemas and policies and wsdlimports not working yet.

Added:
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java
      - copied, changed from r1161284, cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
    cxf/trunk/rt/ws/mex/
    cxf/trunk/rt/ws/mex/pom.xml   (with props)
    cxf/trunk/rt/ws/mex/src/
    cxf/trunk/rt/ws/mex/src/main/
    cxf/trunk/rt/ws/mex/src/main/java/
    cxf/trunk/rt/ws/mex/src/main/java/org/
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java   (with props)
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java   (with props)
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java   (with props)
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java   (with props)
    cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java   (with props)
    cxf/trunk/rt/ws/mex/src/main/model/
    cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb   (with props)
    cxf/trunk/rt/ws/mex/src/main/model/binding.xjb   (with props)
    cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd   (with props)
    cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl   (with props)
    cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.xsd   (with props)
    cxf/trunk/rt/ws/mex/src/main/model/ws-addr.xsd   (with props)
    cxf/trunk/rt/ws/mex/src/main/resources/
    cxf/trunk/rt/ws/mex/src/main/resources/META-INF/
    cxf/trunk/rt/ws/mex/src/main/resources/META-INF/cxf/
    cxf/trunk/rt/ws/mex/src/main/resources/META-INF/cxf/bus-extensions.txt   (with props)
    cxf/trunk/rt/ws/mex/src/test/
    cxf/trunk/rt/ws/mex/src/test/java/
    cxf/trunk/rt/ws/mex/src/test/java/org/
    cxf/trunk/rt/ws/mex/src/test/java/org/apache/
    cxf/trunk/rt/ws/mex/src/test/java/org/apache/cxf/
    cxf/trunk/rt/ws/mex/src/test/java/org/apache/cxf/ws/
    cxf/trunk/rt/ws/mex/src/test/java/org/apache/cxf/ws/mex/
    cxf/trunk/rt/ws/mex/src/test/java/org/apache/cxf/ws/mex/MEXTest.java   (with props)
Modified:
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java?rev=1161285&r1=1161284&r2=1161285&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java Wed Aug 24 21:27:35 2011
@@ -21,77 +21,65 @@ package org.apache.cxf.frontend;
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.Collection;
-import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.schema.SchemaImport;
-import javax.wsdl.extensions.schema.SchemaReference;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Document;
-import org.w3c.dom.Element;
 
-import org.xml.sax.InputSource;
 
-import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
-import org.apache.cxf.catalog.OASISCatalogManager;
-import org.apache.cxf.catalog.OASISCatalogManagerHelper;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
-import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.http.UrlUtilities;
-import org.apache.cxf.wsdl.WSDLManager;
-import org.apache.cxf.wsdl11.ResourceManagerWSDLLocator;
-import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
 
 /**
  * 
  */
 public class WSDLGetInterceptor extends AbstractPhaseInterceptor<Message> {
     public static final WSDLGetInterceptor INSTANCE = new WSDLGetInterceptor();
-    
-    public static final String AUTO_REWRITE_ADDRESS = "autoRewriteSoapAddress";
-    public static final String PUBLISHED_ENDPOINT_URL = "publishedEndpointUrl";
-    
-    private static final String WSDLS_KEY = WSDLGetInterceptor.class.getName() + ".WSDLs";
-    private static final String SCHEMAS_KEY = WSDLGetInterceptor.class.getName() + ".Schemas";
-    
+       
     private static final Logger LOG = LogUtils.getL7dLogger(WSDLGetInterceptor.class);
     
     public WSDLGetInterceptor() {
         super(Phase.READ);
         getAfter().add(EndpointSelectionInterceptor.class.getName());
     }
+    
+    public void doOutput(Message message, String base, Document doc, OutputStream out)
+        throws WSDLQueryException {
+        String enc = null;
+        try {
+            enc = doc.getXmlEncoding();
+        } catch (Exception ex) {
+            //ignore - not dom level 3
+        }
+        if (enc == null) {
+            enc = "utf-8";
+        }
+
+        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out,
+                                                                 enc);
+        try {
+            StaxUtils.writeNode(doc, writer, true);
+            writer.flush();
+        } catch (XMLStreamException e) {
+            throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
+                                                                                LOG,
+                                                                                base), e);
+        }
+    }
+
 
     public void handleMessage(Message message) throws Fault {
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
@@ -118,23 +106,44 @@ public class WSDLGetInterceptor extends 
                     mout.put(Message.CONTENT_TYPE, "text/xml");
                     c.prepare(mout);
                     OutputStream os = mout.getContent(OutputStream.class);
-                    writeResponse(message,
+                    Document doc = getDocument(message,
                                   baseUri,
                                   map,
                                   ctx,
-                                  message.getExchange().getEndpoint().getEndpointInfo(),
-                                  os);
+                                  message.getExchange().getEndpoint().getEndpointInfo());
+                    String enc = null;
+                    try {
+                        enc = doc.getXmlEncoding();
+                    } catch (Exception ex) {
+                        //ignore - not dom level 3
+                    }
+                    if (enc == null) {
+                        enc = "utf-8";
+                    }
+
+                    XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os,
+                                                                             enc);
+                    StaxUtils.writeNode(doc, writer, true);
+                    writer.flush();
                     os.close();
                     message.getInterceptorChain().abort();
                 } catch (IOException e) {
                     throw new Fault(e);
+                } catch (XMLStreamException e) {
+                    throw new Fault(e);
                 } finally {
                     message.getExchange().setOutMessage(null);
                 }
             }
         }
     }
-
+    public Document getDocument(Message message,
+                                String base,
+                                Map<String, String> params,
+                                String ctxUri,
+                                EndpointInfo endpointInfo) {
+        return new WSDLGetUtils().getDocument(message, base, params, ctxUri, endpointInfo);
+    }
     public boolean isRecognizedQuery(Map<String, String> map,
                                      String baseUri,
                                      String ctx, 
@@ -146,455 +155,4 @@ public class WSDLGetInterceptor extends 
         return false;
     }
 
-    public void writeResponse(Message message,
-                              String base,
-                              Map<String, String> params,
-                              String ctxUri,
-                              EndpointInfo endpointInfo,
-                              OutputStream os) {
-        try {
-            Bus bus = message.getExchange().getBus();
-            Object prop = message.getContextualProperty(PUBLISHED_ENDPOINT_URL);
-            if (prop != null) {
-                base = String.valueOf(prop);
-            }
-
-            String wsdl = params.get("wsdl");
-            if (wsdl != null) {
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup.
-                wsdl = URLDecoder.decode(wsdl, "utf-8");
-            }
-            
-            String xsd =  params.get("xsd");
-            if (xsd != null) {
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup.
-                xsd = URLDecoder.decode(xsd, "utf-8");
-            }
-            
-            Map<String, Definition> mp = CastUtils.cast((Map)endpointInfo.getService()
-                                                        .getProperty(WSDLS_KEY));
-            Map<String, SchemaReference> smp = CastUtils.cast((Map)endpointInfo.getService()
-                                                        .getProperty(SCHEMAS_KEY));
-
-            if (mp == null) {
-                endpointInfo.getService().setProperty(WSDLS_KEY,
-                                                      new ConcurrentHashMap());
-                mp = CastUtils.cast((Map)endpointInfo.getService()
-                                    .getProperty(WSDLS_KEY));
-            }
-            if (smp == null) {
-                endpointInfo.getService().setProperty(SCHEMAS_KEY,
-                                                      new ConcurrentHashMap());
-                smp = CastUtils.cast((Map)endpointInfo.getService()
-                                    .getProperty(SCHEMAS_KEY));
-            }
-            
-            if (!mp.containsKey("")) {
-                Definition def = new ServiceWSDLBuilder(bus,
-                                                        endpointInfo.getService()).build();
-
-                mp.put("", def);
-                updateDefinition(bus, def, mp, smp, base, endpointInfo);
-            }
-            
-            
-            Document doc;
-            if (xsd == null) {
-                Definition def = mp.get(wsdl);
-                if (def == null) {
-                    String wsdl2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
-                                                       wsdl,
-                                                       base);
-                    if (wsdl2 != null) {
-                        def = mp.get(wsdl2);
-                    }
-                }
-                if (def == null) {
-                    throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("WSDL_NOT_FOUND",
-                                                                                        LOG, wsdl), null);
-                }
-                
-                synchronized (def) {
-                    //writing a def is not threadsafe.  Sync on it to make sure
-                    //we don't get any ConcurrentModificationExceptions
-                    if (endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL) != null) {
-                        String epurl = 
-                            String.valueOf(endpointInfo.getProperty(PUBLISHED_ENDPOINT_URL));
-                        updatePublishedEndpointUrl(epurl, def, endpointInfo.getName());
-                        base = epurl;
-                    }
-        
-                    WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class)
-                        .getWSDLFactory().newWSDLWriter();
-                    def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
-                    doc = wsdlWriter.getDocument(def);
-                }
-            } else {
-                SchemaReference si = smp.get(xsd);
-                if (si == null) {
-                    String xsd2 = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
-                                                       xsd,
-                                                       base);
-                    if (xsd2 != null) { 
-                        si = smp.get(xsd2);
-                    }
-                }
-                if (si == null) {
-                    throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("SCHEMA_NOT_FOUND", 
-                                                                                        LOG, wsdl), null);
-                }
-                
-                String uri = si.getReferencedSchema().getDocumentBaseURI();
-                uri = resolveWithCatalogs(OASISCatalogManager.getCatalogManager(bus),
-                                          uri,
-                                          si.getReferencedSchema().getDocumentBaseURI());
-                if (uri == null) {
-                    uri = si.getReferencedSchema().getDocumentBaseURI();
-                }
-                ResourceManagerWSDLLocator rml = new ResourceManagerWSDLLocator(uri,
-                                                                                bus);
-                
-                InputSource src = rml.getBaseInputSource();
-                doc = XMLUtils.getParser().parse(src);
-            }
-            
-            updateDoc(doc, base, mp, smp, message);
-            String enc = null;
-            try {
-                enc = doc.getXmlEncoding();
-            } catch (Exception ex) {
-                //ignore - not dom level 3
-            }
-            if (enc == null) {
-                enc = "utf-8";
-            }
-
-            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os,
-                                                                     enc);
-            StaxUtils.writeNode(doc, writer, true);
-            writer.flush();
-        } catch (WSDLQueryException wex) {
-            throw wex;
-        } catch (Exception wex) {
-            throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                                                     LOG,
-                                                     base), wex);
-        }
-    }
-    
-    protected void updateDoc(Document doc, 
-                           String base,
-                           Map<String, Definition> mp,
-                           Map<String, SchemaReference> smp,
-                           Message message) {        
-        List<Element> elementList = null;
-        Object rewriteSoapAddress = message.getContextualProperty(AUTO_REWRITE_ADDRESS);
-        
-        try {
-            elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
-                                                                           "http://www.w3.org/2001/XMLSchema",
-                                                                           "import");
-            for (Element el : elementList) {
-                String sl = el.getAttribute("schemaLocation");
-                if (smp.containsKey(URLDecoder.decode(sl, "utf-8"))) {
-                    el.setAttribute("schemaLocation", base + "?xsd=" + sl.replace(" ", "%20"));
-                }
-            }
-            
-            elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
-                                                              "http://www.w3.org/2001/XMLSchema",
-                                                              "include");
-            for (Element el : elementList) {
-                String sl = el.getAttribute("schemaLocation");
-                if (smp.containsKey(URLDecoder.decode(sl, "utf-8"))) {
-                    el.setAttribute("schemaLocation", base + "?xsd=" + sl.replace(" ", "%20"));
-                }
-            }
-            elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
-                                                              "http://www.w3.org/2001/XMLSchema",
-                                                              "redefine");
-            for (Element el : elementList) {
-                String sl = el.getAttribute("schemaLocation");
-                if (smp.containsKey(URLDecoder.decode(sl, "utf-8"))) {
-                    el.setAttribute("schemaLocation", base + "?xsd=" + sl.replace(" ", "%20"));
-                }
-            }
-            elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
-                                                              "http://schemas.xmlsoap.org/wsdl/",
-                                                              "import");
-            for (Element el : elementList) {
-                String sl = el.getAttribute("location");
-                if (mp.containsKey(URLDecoder.decode(sl, "utf-8"))) {
-                    el.setAttribute("location", base + "?wsdl=" + sl.replace(" ", "%20"));
-                }
-            }
-        } catch (UnsupportedEncodingException e) {
-            throw new WSDLQueryException(new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                    LOG,
-                    base), e);
-        }
-
-        if (rewriteSoapAddress == null || MessageUtils.isTrue(rewriteSoapAddress)) {
-            List<Element> serviceList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
-                                                              "http://schemas.xmlsoap.org/wsdl/",
-                                                              "service");
-            for (Element serviceEl : serviceList) {
-                String serviceName = serviceEl.getAttribute("name");
-                if (serviceName.equals(message.getExchange().getService().getName().getLocalPart())) {
-                    elementList = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
-                                                                      "http://schemas.xmlsoap.org/wsdl/",
-                                                                      "port");
-                    for (Element el : elementList) {
-                        String name = el.getAttribute("name");
-                        if (name.equals(message.getExchange().getEndpoint().getEndpointInfo()
-                                            .getName().getLocalPart())) {
-                            
-                            rewriteAddress(base, el, "http://schemas.xmlsoap.org/wsdl/soap/");
-                            rewriteAddress(base, el, "http://schemas.xmlsoap.org/wsdl/soap12/");
-                        }
-                    }
-                }
-            }
-        }
-        try {
-            doc.setXmlStandalone(true);
-        } catch (Exception ex) {
-            //likely not DOM level 3
-        }
-    }
-
-    private void rewriteAddress(String base, Element el, String soapNS) {
-        List<Element> sadEls = DOMUtils.findAllElementsByTagNameNS(el,
-                                             soapNS,
-                                             "address");
-        for (Element soapAddress : sadEls) {
-            soapAddress.setAttribute("location", base);
-        }
-    }
-
-    static String resolveWithCatalogs(OASISCatalogManager catalogs, String start, String base) {
-        try {
-            return new OASISCatalogManagerHelper().resolve(catalogs, start, base);
-        } catch (Exception ex) {
-            //ignore
-        }
-        return null;
-    }
-    
-    protected void updateDefinition(Bus bus,
-                                    Definition def, Map<String, Definition> done,
-                                  Map<String, SchemaReference> doneSchemas,
-                                  String base, EndpointInfo ei) {
-        OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);    
-        
-        Collection<List<?>> imports = CastUtils.cast((Collection<?>)def.getImports().values());
-        for (List<?> lst : imports) {
-            List<Import> impLst = CastUtils.cast(lst);
-            for (Import imp : impLst) {
-                
-                String start = imp.getLocationURI();
-                String decodedStart = null;
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup. 
-                try {
-                    decodedStart = URLDecoder.decode(start, "utf-8");
-                } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(
-                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                            LOG,
-                            start), e);
-                }
-                
-                String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
-                
-                if (resolvedSchemaLocation == null) {
-                    try {
-                        //check to see if it's already in a URL format.  If so, leave it.
-                        new URL(start);
-                    } catch (MalformedURLException e) {
-                        if (done.put(decodedStart, imp.getDefinition()) == null) {
-                            updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, ei);
-                        }
-                    }
-                } else {
-                    if (done.put(decodedStart, imp.getDefinition()) == null) {
-                        done.put(resolvedSchemaLocation, imp.getDefinition());
-                        updateDefinition(bus, imp.getDefinition(), done, doneSchemas, base, ei);
-                    }
-                }
-            }
-        }      
-        
-        
-        /* This doesn't actually work.   Setting setSchemaLocationURI on the import
-        * for some reason doesn't actually result in the new URI being written
-        * */
-        Types types = def.getTypes();
-        if (types != null) {
-            for (ExtensibilityElement el 
-                : CastUtils.cast((List)types.getExtensibilityElements(), ExtensibilityElement.class)) {
-                if (el instanceof Schema) {
-                    Schema see = (Schema)el;
-                    updateSchemaImports(bus, see, doneSchemas, base);
-                }
-            }
-        }
-    }    
-
-    protected void updatePublishedEndpointUrl(String publishingUrl, Definition def, QName name) {
-        Collection<Service> services = CastUtils.cast(def.getAllServices().values());
-        for (Service service : services) {
-            Collection<Port> ports = CastUtils.cast(service.getPorts().values());
-            if (ports.isEmpty()) {
-                continue;
-            }
-            
-            if (name == null) {
-                setSoapAddressLocationOn(ports.iterator().next(), publishingUrl);
-                break; // only update the first port since we don't target any specific port
-            } else {
-                for (Port port : ports) {
-                    if (name.getLocalPart().equals(port.getName())) {
-                        setSoapAddressLocationOn(port, publishingUrl);
-                    }
-                }
-            }
-        }
-    }
-    
-    private void setSoapAddressLocationOn(Port port, String url) {
-        List<?> extensions = port.getExtensibilityElements();
-        for (Object extension : extensions) {
-            if (extension instanceof SOAP12Address) {
-                ((SOAP12Address)extension).setLocationURI(url);
-            } else if (extension instanceof SOAPAddress) {
-                ((SOAPAddress)extension).setLocationURI(url);
-            }
-        }
-    }
-    
-    protected void updateSchemaImports(Bus bus, 
-                                       Schema schema,
-                                       Map<String, SchemaReference> doneSchemas,
-                                       String base) {
-        OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);    
-        Collection<List<?>>  imports = CastUtils.cast((Collection<?>)schema.getImports().values());
-        for (List<?> lst : imports) {
-            List<SchemaImport> impLst = CastUtils.cast(lst);
-            for (SchemaImport imp : impLst) {
-                String start = imp.getSchemaLocationURI();
-                
-                if (start != null) {
-                    String decodedStart = null;
-                    // Always use the URL decoded version to ensure that we have a
-                    // canonical representation of the import URL for lookup. 
-                    try {
-                        decodedStart = URLDecoder.decode(start, "utf-8");
-                    } catch (UnsupportedEncodingException e) {
-                        throw new WSDLQueryException(
-                                new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                                LOG,
-                                start), e);
-                    }
-                    
-                    if (!doneSchemas.containsKey(decodedStart)) {
-                        String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
-                        if (resolvedSchemaLocation == null) {
-                            try {
-                                //check to see if it's already in a URL format.  If so, leave it.
-                                new URL(start);
-                            } catch (MalformedURLException e) {
-                                if (doneSchemas.put(decodedStart, imp) == null) {
-                                    updateSchemaImports(bus, imp.getReferencedSchema(), doneSchemas, base);
-                                }
-                            }
-                        } else {
-                            if (doneSchemas.put(decodedStart, imp) == null) {
-                                doneSchemas.put(resolvedSchemaLocation, imp);
-                                updateSchemaImports(bus, imp.getReferencedSchema(), doneSchemas, base);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        
-        List<SchemaReference> includes = CastUtils.cast(schema.getIncludes());
-        for (SchemaReference included : includes) {
-            String start = included.getSchemaLocationURI();
-
-            if (start != null) {
-                String decodedStart = null;
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup. 
-                try {
-                    decodedStart = URLDecoder.decode(start, "utf-8");
-                } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(
-                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                            LOG,
-                            start), e);
-                }
-                
-                String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
-                if (resolvedSchemaLocation == null) {
-                    if (!doneSchemas.containsKey(decodedStart)) {
-                        try {
-                            //check to see if it's aleady in a URL format.  If so, leave it.
-                            new URL(start);
-                        } catch (MalformedURLException e) {
-                            if (doneSchemas.put(decodedStart, included) == null) {
-                                updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
-                            }
-                        }
-                    }
-                } else if (!doneSchemas.containsKey(decodedStart) 
-                    || !doneSchemas.containsKey(resolvedSchemaLocation)) {
-                    doneSchemas.put(decodedStart, included);
-                    doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
-                }
-            }
-        }
-        List<SchemaReference> redefines = CastUtils.cast(schema.getRedefines());
-        for (SchemaReference included : redefines) {
-            String start = included.getSchemaLocationURI();
-
-            if (start != null) {
-                String decodedStart = null;
-                // Always use the URL decoded version to ensure that we have a
-                // canonical representation of the import URL for lookup. 
-                try {
-                    decodedStart = URLDecoder.decode(start, "utf-8");
-                } catch (UnsupportedEncodingException e) {
-                    throw new WSDLQueryException(
-                            new org.apache.cxf.common.i18n.Message("COULD_NOT_PROVIDE_WSDL",
-                            LOG,
-                            start), e);
-                }
-                
-                String resolvedSchemaLocation = resolveWithCatalogs(catalogs, start, base);
-                if (resolvedSchemaLocation == null) {
-                    if (!doneSchemas.containsKey(decodedStart)) {
-                        try {
-                            //check to see if it's aleady in a URL format.  If so, leave it.
-                            new URL(start);
-                        } catch (MalformedURLException e) {
-                            if (doneSchemas.put(decodedStart, included) == null) {
-                                updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
-                            }
-                        }
-                    }
-                } else if (!doneSchemas.containsKey(decodedStart) 
-                    || !doneSchemas.containsKey(resolvedSchemaLocation)) {
-                    doneSchemas.put(decodedStart, included);
-                    doneSchemas.put(resolvedSchemaLocation, included);
-                    updateSchemaImports(bus, included.getReferencedSchema(), doneSchemas, base);
-                }
-            }
-        }
-    }
-
 }

Copied: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java (from r1161284, cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java)
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java?p2=cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java&p1=cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java&r1=1161284&r2=1161285&rev=1161285&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetInterceptor.java (original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/WSDLGetUtils.java Wed Aug 24 21:27:35 2011
@@ -19,8 +19,6 @@
 
 package org.apache.cxf.frontend;
 
-import java.io.IOException;
-import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -44,7 +42,6 @@ import javax.wsdl.extensions.soap.SOAPAd
 import javax.wsdl.extensions.soap12.SOAP12Address;
 import javax.wsdl.xml.WSDLWriter;
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -52,24 +49,15 @@ import org.w3c.dom.Element;
 import org.xml.sax.InputSource;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
 import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.catalog.OASISCatalogManagerHelper;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.XMLUtils;
-import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.message.MessageUtils;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
-import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.http.UrlUtilities;
 import org.apache.cxf.wsdl.WSDLManager;
 import org.apache.cxf.wsdl11.ResourceManagerWSDLLocator;
 import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
@@ -77,81 +65,27 @@ import org.apache.cxf.wsdl11.ServiceWSDL
 /**
  * 
  */
-public class WSDLGetInterceptor extends AbstractPhaseInterceptor<Message> {
-    public static final WSDLGetInterceptor INSTANCE = new WSDLGetInterceptor();
+public class WSDLGetUtils {
     
     public static final String AUTO_REWRITE_ADDRESS = "autoRewriteSoapAddress";
     public static final String PUBLISHED_ENDPOINT_URL = "publishedEndpointUrl";
     
-    private static final String WSDLS_KEY = WSDLGetInterceptor.class.getName() + ".WSDLs";
-    private static final String SCHEMAS_KEY = WSDLGetInterceptor.class.getName() + ".Schemas";
+    private static final String WSDLS_KEY = WSDLGetUtils.class.getName() + ".WSDLs";
+    private static final String SCHEMAS_KEY = WSDLGetUtils.class.getName() + ".Schemas";
     
     private static final Logger LOG = LogUtils.getL7dLogger(WSDLGetInterceptor.class);
     
-    public WSDLGetInterceptor() {
-        super(Phase.READ);
-        getAfter().add(EndpointSelectionInterceptor.class.getName());
+    public WSDLGetUtils() {
+        //never constructed
     }
 
-    public void handleMessage(Message message) throws Fault {
-        String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
-        String query = (String)message.get(Message.QUERY_STRING);
-        if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
-            return;
-        }
-        String baseUri = (String)message.get(Message.REQUEST_URL);
-        String ctx = (String)message.get(Message.PATH_INFO);
-        
-        
-        //cannot have two wsdl's being written for the same endpoint at the same
-        //time as the addresses may get mixed up
-        synchronized (message.getExchange().getEndpoint()) {
-            Map<String, String> map = UrlUtilities.parseQueryString(query);
-            if (isRecognizedQuery(map, baseUri, ctx, 
-                                  message.getExchange().getEndpoint().getEndpointInfo())) {
-                
-                try {
-                    Conduit c = message.getExchange().getDestination().getBackChannel(message, null, null);
-                    Message mout = new MessageImpl();
-                    mout.setExchange(message.getExchange());
-                    message.getExchange().setOutMessage(mout);
-                    mout.put(Message.CONTENT_TYPE, "text/xml");
-                    c.prepare(mout);
-                    OutputStream os = mout.getContent(OutputStream.class);
-                    writeResponse(message,
-                                  baseUri,
-                                  map,
-                                  ctx,
-                                  message.getExchange().getEndpoint().getEndpointInfo(),
-                                  os);
-                    os.close();
-                    message.getInterceptorChain().abort();
-                } catch (IOException e) {
-                    throw new Fault(e);
-                } finally {
-                    message.getExchange().setOutMessage(null);
-                }
-            }
-        }
-    }
 
-    public boolean isRecognizedQuery(Map<String, String> map,
-                                     String baseUri,
-                                     String ctx, 
-                                     EndpointInfo endpointInfo) {
-        if (map.containsKey("wsdl")
-            || map.containsKey("xsd")) {
-            return true;
-        }
-        return false;
-    }
 
-    public void writeResponse(Message message,
-                              String base,
-                              Map<String, String> params,
-                              String ctxUri,
-                              EndpointInfo endpointInfo,
-                              OutputStream os) {
+    public Document getDocument(Message message,
+                            String base,
+                            Map<String, String> params,
+                            String ctxUri,
+                            EndpointInfo endpointInfo) {
         try {
             Bus bus = message.getExchange().getBus();
             Object prop = message.getContextualProperty(PUBLISHED_ENDPOINT_URL);
@@ -261,20 +195,8 @@ public class WSDLGetInterceptor extends 
             }
             
             updateDoc(doc, base, mp, smp, message);
-            String enc = null;
-            try {
-                enc = doc.getXmlEncoding();
-            } catch (Exception ex) {
-                //ignore - not dom level 3
-            }
-            if (enc == null) {
-                enc = "utf-8";
-            }
-
-            XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(os,
-                                                                     enc);
-            StaxUtils.writeNode(doc, writer, true);
-            writer.flush();
+            
+            return doc;
         } catch (WSDLQueryException wex) {
             throw wex;
         } catch (Exception wex) {
@@ -365,7 +287,7 @@ public class WSDLGetInterceptor extends 
         }
     }
 
-    private void rewriteAddress(String base, Element el, String soapNS) {
+    protected void rewriteAddress(String base, Element el, String soapNS) {
         List<Element> sadEls = DOMUtils.findAllElementsByTagNameNS(el,
                                              soapNS,
                                              "address");
@@ -374,7 +296,7 @@ public class WSDLGetInterceptor extends 
         }
     }
 
-    static String resolveWithCatalogs(OASISCatalogManager catalogs, String start, String base) {
+    protected String resolveWithCatalogs(OASISCatalogManager catalogs, String start, String base) {
         try {
             return new OASISCatalogManagerHelper().resolve(catalogs, start, base);
         } catch (Exception ex) {
@@ -384,9 +306,9 @@ public class WSDLGetInterceptor extends 
     }
     
     protected void updateDefinition(Bus bus,
-                                    Definition def, Map<String, Definition> done,
-                                  Map<String, SchemaReference> doneSchemas,
-                                  String base, EndpointInfo ei) {
+                                 Definition def, Map<String, Definition> done,
+                                 Map<String, SchemaReference> doneSchemas,
+                                 String base, EndpointInfo ei) {
         OASISCatalogManager catalogs = OASISCatalogManager.getCatalogManager(bus);    
         
         Collection<List<?>> imports = CastUtils.cast((Collection<?>)def.getImports().values());
@@ -464,7 +386,7 @@ public class WSDLGetInterceptor extends 
         }
     }
     
-    private void setSoapAddressLocationOn(Port port, String url) {
+    protected void setSoapAddressLocationOn(Port port, String url) {
         List<?> extensions = port.getExtensibilityElements();
         for (Object extension : extensions) {
             if (extension instanceof SOAP12Address) {

Added: cxf/trunk/rt/ws/mex/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/pom.xml?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/pom.xml (added)
+++ cxf/trunk/rt/ws/mex/pom.xml Wed Aug 24 21:27:35 2011
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-rt-ws-mex</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache CXF Runtime WS MetadataExchange</name>
+    <url>http://cxf.apache.org</url>
+
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>2.5.0-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-common-utilities</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-bindings-soap</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-policy</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-addr</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${project.version}</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-local</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-xjc-plugin</artifactId>
+            <version>${cxf.xjc-utils.version}</version>
+            <executions>
+                <execution>
+                    <id>generate-sources</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>xsdtojava</goal>
+                    </goals>
+                    <configuration>
+                        <extensions>
+                            <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:${cxf.xjc-utils.version}</extension>
+                        </extensions>
+                        <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+                        <xsdOptions>
+                            <xsdOption>
+                                <extension>true</extension>
+                                <xsd>${basedir}/src/main/model/metadataexchange-2004-09.xsd</xsd>
+                                <bindingFile>${basedir}/src/main/model/binding-2004.xjb</bindingFile>
+                            </xsdOption>
+                        </xsdOptions>
+                    </configuration>
+                </execution>
+            </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Propchange: cxf/trunk/rt/ws/mex/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/mex/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java (added)
+++ cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java Wed Aug 24 21:27:35 2011
@@ -0,0 +1,153 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.mex;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.Addressing;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+
+
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)
+@Addressing(required = true, enabled = true)
+@XmlSeeAlso({
+    org.apache.cxf.ws.mex.model._2004_09.ObjectFactory.class })
+public class MEXEndpoint implements MetadataExchange {
+    Server server;
+    
+    public MEXEndpoint(EndpointImpl server) {
+        this(server.getServer());
+    }
+    
+    public MEXEndpoint(Server server) {
+        this.server = server;
+    }
+    
+    private String getAddressingNamespace() {
+        return PhaseInterceptorChain.getCurrentMessage()
+                .get(AddressingProperties.class).getNamespaceURI();
+    }
+   
+    
+    public org.apache.cxf.ws.mex.model._2004_09.Metadata get2004() {
+        org.apache.cxf.ws.mex.model._2004_09.Metadata metadata 
+            = new org.apache.cxf.ws.mex.model._2004_09.Metadata();
+        
+        Element el = MEXUtils.getWSDL(server);
+        if (el != null) {
+            org.apache.cxf.ws.mex.model._2004_09.MetadataSection sect 
+                = new org.apache.cxf.ws.mex.model._2004_09.MetadataSection();
+            sect.setAny(el);
+            sect.setIdentifier(el.getAttribute("targetNamespace"));
+            sect.setDialect("http://schemas.xmlsoap.org/wsdl/");
+            metadata.getMetadataSection().add(sect);
+        }
+        Map<String, String> schemas = MEXUtils.getSchemaLocations(server);
+        if (schemas != null && !schemas.isEmpty()) {
+            for (Map.Entry<String, String> s : schemas.entrySet()) {
+                org.apache.cxf.ws.mex.model._2004_09.MetadataSection sect
+                    = new org.apache.cxf.ws.mex.model._2004_09.MetadataSection();
+                sect.setDialect("http://www.w3.org/2001/XMLSchema");
+                sect.setIdentifier(s.getKey());
+                sect.setLocation(s.getValue());
+                metadata.getMetadataSection().add(sect);
+            }
+        }
+        Map<String, String> policies = MEXUtils.getPolicyLocations(server);
+        if (schemas != null && !policies.isEmpty()) {
+            for (Map.Entry<String, String>  s : policies.entrySet()) {
+                org.apache.cxf.ws.mex.model._2004_09.MetadataSection sect 
+                    = new org.apache.cxf.ws.mex.model._2004_09.MetadataSection();
+                sect.setDialect("http://schemas.xmlsoap.org/ws/2004/09/policy");
+                sect.setIdentifier(s.getKey());
+                org.apache.cxf.ws.mex.model._2004_09.MetadataReference ref 
+                    = new org.apache.cxf.ws.mex.model._2004_09.MetadataReference();
+                
+                el = DOMUtils.createDocument().createElementNS(getAddressingNamespace(), 
+                                                               "wsa:Address");
+                el.setTextContent(s.getValue());
+                ref.getAny().add(el);
+                sect.setMetadataReference(ref);
+                metadata.getMetadataSection().add(sect);
+            }
+        }
+        
+        return metadata;
+    }
+    
+    
+    public org.apache.cxf.ws.mex.model._2004_09.Metadata getMetadata(
+        org.apache.cxf.ws.mex.model._2004_09.GetMetadata body
+    ) {
+        String dialect = body.getDialect();
+        String id = body.getIdentifier();
+        org.apache.cxf.ws.mex.model._2004_09.Metadata metadata
+            = new org.apache.cxf.ws.mex.model._2004_09.Metadata();
+        
+        if ("http://schemas.xmlsoap.org/wsdl/".equals(dialect)) {
+            Element el = MEXUtils.getWSDL(server);
+            if (el != null) {
+                org.apache.cxf.ws.mex.model._2004_09.MetadataSection sect 
+                    = new org.apache.cxf.ws.mex.model._2004_09.MetadataSection();
+                sect.setAny(el);
+                sect.setDialect("http://schemas.xmlsoap.org/wsdl/");
+                metadata.getMetadataSection().add(sect);
+            }  
+        } else if ("http://www.w3.org/2001/XMLSchema".equals(dialect)) {
+            List<Element> schemas = MEXUtils.getSchemas(server, id);
+            for (Element el : schemas) {
+                org.apache.cxf.ws.mex.model._2004_09.MetadataSection sect 
+                    = new org.apache.cxf.ws.mex.model._2004_09.MetadataSection();
+                sect.setAny(el);
+                sect.setDialect("http://www.w3.org/2001/XMLSchema");
+                sect.setIdentifier(DOMUtils.getAttributeValueEmptyNull(el, "targetNamespace"));
+                metadata.getMetadataSection().add(sect);
+            }
+        } else if ("http://schemas.xmlsoap.org/ws/2004/09/policy".equals(dialect)) {
+            List<Element> policies = MEXUtils.getPolicies(server, id);
+            for (Element el : policies) {
+                org.apache.cxf.ws.mex.model._2004_09.MetadataSection sect 
+                    = new org.apache.cxf.ws.mex.model._2004_09.MetadataSection();
+                sect.setAny(el);
+                sect.setDialect("http://schemas.xmlsoap.org/ws/2004/09/policy");
+                if (id == null) {
+                    sect.setIdentifier(DOMUtils.getAttributeValueEmptyNull(el, "Name"));
+                } else {
+                    sect.setIdentifier(id);
+                }
+                metadata.getMetadataSection().add(sect);
+            }
+        }
+        return metadata;
+    }
+
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXEndpoint.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java (added)
+++ cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java Wed Aug 24 21:27:35 2011
@@ -0,0 +1,112 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.mex;
+
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.binding.soap.SoapBindingConstants;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.EndpointException;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.jaxws.JAXWSMethodInvoker;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.JAXWSAConstants;
+import org.apache.cxf.ws.addressing.MAPAggregator;
+import org.apache.cxf.ws.addressing.WSAddressingFeature;
+import org.apache.cxf.ws.policy.AssertionInfoMap;
+
+/**
+ * 
+ */
+public class MEXInInterceptor extends AbstractPhaseInterceptor<Message> {
+    final MEXEndpoint ep;
+    Endpoint mexEndpoint;
+    
+    public MEXInInterceptor(Server serv) {
+        super(Phase.PRE_PROTOCOL);
+        ep = new MEXEndpoint(serv);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        String action = (String)message.get(SoapBindingConstants.SOAP_ACTION);
+        if (action == null) {
+            AddressingProperties inProps = (AddressingProperties)message
+                .getContextualProperty(JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND);
+            if (inProps != null) {
+                action = inProps.getAction().getValue();
+            }
+        }
+        if ("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get".equals(action)) {
+            message.remove(AssertionInfoMap.class);
+            Exchange ex = message.getExchange();
+            Endpoint endpoint = createEndpoint(message);
+            ex.put(Endpoint.class, endpoint);
+            ex.put(Service.class, endpoint.getService());
+            ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
+            ex.put(BindingOperationInfo.class, 
+                   endpoint.getBinding().getBindingInfo()
+                       .getOperation(new QName("http://mex.ws.cxf.apache.org/", "Get2004")));
+            ex.remove(BindingOperationInfo.class);
+            message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
+            message.getInterceptorChain().add(endpoint.getInInterceptors());
+            message.getInterceptorChain().add(endpoint.getBinding().getInInterceptors());
+        }
+
+    }
+
+    private static class MEXJaxWsServerFactoryBean extends JaxWsServerFactoryBean {
+        public MEXJaxWsServerFactoryBean(Bus b) {
+            setServiceClass(MEXEndpoint.class);
+            setServiceName(new QName("http://mex.ws.cxf.apache.org/", "MEXEndpoint"));
+            setBus(b);
+        }
+        public Endpoint createEndpoint() throws BusException, EndpointException {
+            Endpoint ep = super.createEndpoint();
+            new WSAddressingFeature().initialize(ep, getBus());
+            return ep;
+        }        
+    }
+    private synchronized Endpoint createEndpoint(Message message) {
+        if (mexEndpoint == null) {
+            MEXJaxWsServerFactoryBean factory 
+                = new MEXJaxWsServerFactoryBean(message.getExchange().getBus());
+            try {
+                Endpoint endpoint = factory.createEndpoint();
+                endpoint.getService().setInvoker(new JAXWSMethodInvoker(ep));
+                
+                mexEndpoint = endpoint;
+            } catch (Exception ex) {
+                throw new Fault(ex);
+            }
+        }
+        return mexEndpoint;
+    }
+}

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java (added)
+++ cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java Wed Aug 24 21:27:35 2011
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.mex;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.binding.soap.SoapBinding;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerLifeCycleListener;
+
+/**
+ * 
+ */
+public class MEXServerListener implements ServerLifeCycleListener {
+
+    public void startServer(Server serv) {
+        if (serv.getEndpoint().getBinding() instanceof SoapBinding) {
+            QName qn = serv.getEndpoint().getService().getName();
+            if (!qn.getNamespaceURI().equals("http://mex.ws.cxf.apache.org/")) {
+                serv.getEndpoint().getInInterceptors().add(new MEXInInterceptor(serv));
+            }
+        }
+    }
+
+    /** {@inheritDoc}*/
+    public void stopServer(Server arg0) {
+
+    }
+
+}

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXServerListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java (added)
+++ cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java Wed Aug 24 21:27:35 2011
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.mex;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.WSDLGetUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+
+/**
+ * 
+ */
+public final class MEXUtils {
+    private MEXUtils() {
+        //utility
+    }
+
+    public static Element getWSDL(Server server) {
+        Message message = PhaseInterceptorChain.getCurrentMessage();
+        String base = null;
+        String ctxUri = null;
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("wsdl", "");
+        return new WSDLGetUtils().getDocument(message, base, 
+                                              params, ctxUri, 
+                                              server.getEndpoint().getEndpointInfo()).getDocumentElement();
+    }
+
+    public static Map<String, String> getSchemaLocations(Server server) {
+        return null;
+    }
+
+    public static Map<String, String> getPolicyLocations(Server server) {
+        return null;
+    }
+
+    public static List<Element> getSchemas(Server server, String id) {
+        return null;
+    }
+
+    public static List<Element> getPolicies(Server server, String id) {
+        return null;
+    }
+    
+}

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MEXUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java (added)
+++ cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java Wed Aug 24 21:27:35 2011
@@ -0,0 +1,58 @@
+/**
+ * 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.
+ */
+
+package org.apache.cxf.ws.mex;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.Action;
+import javax.xml.ws.soap.Addressing;
+
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+@Addressing(required = true, enabled = true)
+@XmlSeeAlso({
+    org.apache.cxf.ws.mex.model._2004_09.ObjectFactory.class })
+@WebService(targetNamespace = "http://www.w3.org/2009/09/ws-mex")
+public interface MetadataExchange {
+    
+    @WebResult(name = "Metadata", 
+        targetNamespace = "http://schemas.xmlsoap.org/ws/2004/09/mex", 
+        partName = "body")
+    @Action(input = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get",
+        output = "http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse")
+    @WebMethod(operationName = "Get2004")
+    org.apache.cxf.ws.mex.model._2004_09.Metadata get2004();
+    
+    @WebResult(name = "Metadata", 
+        targetNamespace = "http://schemas.xmlsoap.org/ws/2004/09/mex", 
+        partName = "body")
+    @Action(input = "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request", 
+        output = "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Response")
+    @WebMethod(operationName = "GetMetadata2004")
+    org.apache.cxf.ws.mex.model._2004_09.Metadata getMetadata(
+        @WebParam(partName = "body", name = "GetMetadata", 
+            targetNamespace = "http://schemas.xmlsoap.org/ws/2004/09/mex")
+        org.apache.cxf.ws.mex.model._2004_09.GetMetadata body
+    );
+
+}

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/java/org/apache/cxf/ws/mex/MetadataExchange.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb (added)
+++ cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb Wed Aug 24 21:27:35 2011
@@ -0,0 +1,32 @@
+<?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.
+-->
+<jaxb:bindings version="2.1"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+  xmlns:wsa="http://www.w3.org/2005/08/addressing"
+  jaxb:extensionBindingPrefixes="xjc">
+
+    <jaxb:bindings schemaLocation="metadataexchange-2004-09.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.mex.model._2004_09"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+</jaxb:bindings>

Propchange: cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/mex/src/main/model/binding-2004.xjb
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/ws/mex/src/main/model/binding.xjb
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/model/binding.xjb?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/model/binding.xjb (added)
+++ cxf/trunk/rt/ws/mex/src/main/model/binding.xjb Wed Aug 24 21:27:35 2011
@@ -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.
+-->
+<jaxb:bindings version="2.1"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+  xmlns:wsa="http://www.w3.org/2005/08/addressing"
+  jaxb:extensionBindingPrefixes="xjc">
+
+    <jaxb:bindings schemaLocation="ws-addr.xsd">
+        <jaxb:schemaBindings map="false"/>
+        <jaxb:bindings node="//xs:complexType[@name='EndpointReferenceType']">
+            <jaxb:class ref="org.apache.cxf.ws.addressing.EndpointReferenceType"/>
+        </jaxb:bindings>
+        <jaxb:bindings node="//xs:element[@name='EndpointReference']">
+            <jaxb:class ref="org.apache.cxf.ws.addressing.EndpointReferenceType"/>
+        </jaxb:bindings>
+        <!--jaxb:bindings scd="wsa:ReferenceParameters">
+            <jaxb:class ref="org.apache.cxf.ws.addressing.ReferenceParametersType"/>
+        </jaxb:bindings>
+        <jaxb:bindings scd="wsa:Metadata">
+            <jaxb:class ref="org.apache.cxf.ws.addressing.MetadataType"/>
+        </jaxb:bindings-->
+        <!--jaxb:bindings scd="~wsa:EndpointReferenceType">
+            <jaxb:class ref="org.apache.cxf.ws.addressing.EndpointReferenceType"/>
+		</jaxb:bindings-->
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation="ws-trust-1.3.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.security.sts.provider.model"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="oasis-200401-wss-wssecurity-utility-1.0.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.security.sts.provider.model.utility"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="oasis-200401-wss-wssecurity-secext-1.0.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.security.sts.provider.model.secext"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="xmldsig-core-schema.xsd" node="/xs:schema">
+        <jaxb:schemaBindings>
+            <jaxb:package name="org.apache.cxf.ws.security.sts.provider.model.xmldsig"/>
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+    <jaxb:bindings schemaLocation="ws-policy.xsd" node="/xs:schema">
+        <jaxb:schemaBindings map="false">
+        </jaxb:schemaBindings>
+    </jaxb:bindings>
+</jaxb:bindings>

Propchange: cxf/trunk/rt/ws/mex/src/main/model/binding.xjb
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/model/binding.xjb
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/mex/src/main/model/binding.xjb
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd (added)
+++ cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd Wed Aug 24 21:27:35 2011
@@ -0,0 +1,112 @@
+<?xml version='1.0' encoding='UTF-8' ?>
+<!--
+(c) 2004-2006 BEA Systems Inc., Computer Associates International, Inc.,
+International Business Machines Corporation, Microsoft Corporation,
+Inc., SAP AG, Sun Microsystems, and webMethods. All rights reserved. 
+
+Permission to copy and display the WS-MetadataExchange Specification
+(the "Specification"), in any medium without fee or royalty is hereby
+granted, provided that you include the following on ALL copies of the
+Specification that you make:
+
+1.	A link or URL to the Specification at this location.
+2.	The copyright notice as shown in the Specification.
+
+BEA Systems, Computer Associates, IBM, Microsoft, SAP, Sun, and
+webMethods (collectively, the "Authors") each agree to grant you a
+license, under royalty-free and otherwise reasonable,
+non-discriminatory terms and conditions, to their respective essential
+patent claims that they deem necessary to implement the
+WS-MetadataExchange Specification.
+
+THE SPECIFICATION IS PROVIDED "AS IS," AND THE AUTHORS MAKE NO
+REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
+LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE
+SPECIFICATION ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE
+IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY
+PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY
+USE OR DISTRIBUTION OF THE SPECIFICATIONS.
+
+The name and trademarks of the Authors may NOT be used in any manner,
+including advertising or publicity pertaining to the Specifications or
+their contents without specific, written prior permission. Title to
+copyright in the Specifications will at all times remain with the
+Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+-->
+
+<xs:schema
+    targetNamespace='http://schemas.xmlsoap.org/ws/2004/09/mex'
+    xmlns:tns='http://schemas.xmlsoap.org/ws/2004/09/mex'
+    xmlns:wsa10='http://www.w3.org/2005/08/addressing'
+    xmlns:wsa04='http://schemas.xmlsoap.org/ws/2004/08/addressing'
+    xmlns:xs='http://www.w3.org/2001/XMLSchema'
+    elementFormDefault='qualified'
+    blockDefault='#all' >
+
+  <!-- Get Metadata request -->
+  <xs:element name='GetMetadata' >
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref='tns:Dialect' minOccurs='0' />
+        <xs:element ref='tns:Identifier' minOccurs='0' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='Dialect' type='xs:anyURI' />
+  <xs:element name='Identifier' type='xs:anyURI' />
+
+  <!-- Get Metadata response -->
+  <xs:element name='Metadata' >
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref='tns:MetadataSection'
+                    minOccurs='0'
+                    maxOccurs='unbounded' />
+        <xs:any namespace='##other' processContents='lax'
+                minOccurs='0'
+                maxOccurs='unbounded' />
+      </xs:sequence>
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name='MetadataSection' >
+    <xs:complexType>
+      <xs:choice>
+        <xs:any namespace='##other' processContents='lax' />
+        <xs:element ref='tns:MetadataReference' />
+        <xs:element ref='tns:Location' />
+      </xs:choice>
+      <xs:attribute name='Dialect' type='xs:anyURI' use='required' />
+      <xs:attribute name='Identifier' type='xs:anyURI' />
+      <xs:anyAttribute namespace='##other' processContents='lax' />
+    </xs:complexType>
+  </xs:element>
+  
+  <!-- 
+       Ideally, the type of the MetadataReference would have been
+       the union of wsa04:EndpointReferenceType and
+       wsa10:EndpointReferenceType but unfortunately xs:union only
+       works for simple types. As a result, we have to define
+       the mex:MetadataReference using xs:any.
+  -->
+
+  <xs:element name='MetadataReference'>
+    <xs:complexType>
+      <xs:sequence>
+        <xs:any minOccurs='1' maxOccurs='unbounded' 
+                processContents='lax' namespace='##other' />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name='Location'
+              type='xs:anyURI' />
+</xs:schema>

Propchange: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange-2004-09.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl?rev=1161285&view=auto
==============================================================================
--- cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl (added)
+++ cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl Wed Aug 24 21:27:35 2011
@@ -0,0 +1,93 @@
+<wsdl:definitions
+    targetNamespace='http://www.w3.org/2009/09/ws-mex'
+    xmlns:tns='http://www.w3.org/2009/09/ws-mex'
+    xmlns:wsa='http://www.w3.org/2005/08/addressing'
+    xmlns:wsam='http://www.w3.org/2007/05/addressing/metadata'
+    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
+    xmlns:xs='http://www.w3.org/2001/XMLSchema' >
+
+  <wsdl:types>
+    <xs:schema
+        targetNamespace='http://www.w3.org/2009/09/ws-mex' >
+      <xs:include schemaLocation='metadataexchange.xsd' />
+    </xs:schema>
+  </wsdl:types>
+
+  <wsdl:message name='GetWSDLMsg'>
+    <wsdl:part name='body' element='tns:GetWSDL'/>
+  </wsdl:message>
+
+  <wsdl:message name='GetWSDLResponseMsg'>
+    <wsdl:part name='body' element='tns:GetWSDLResponse'/>
+  </wsdl:message>
+
+  <wsdl:message name='GetMetadataMsg' >
+    <wsdl:part name='body' element='tns:GetMetadata' />
+  </wsdl:message>
+  <wsdl:message name='GetMetadataResponseMsg' >
+    <wsdl:part name='body' element='tns:GetMetadataResponse' />
+  </wsdl:message>
+
+  <wsdl:message name='PutMetadataMsg' >
+    <wsdl:part name='body' element='tns:PutMetadata' />
+  </wsdl:message>
+  <wsdl:message name='PutMetadataResponseMsg' >
+    <wsdl:part name='body' element='tns:PutMetadataResponse' />
+  </wsdl:message>
+
+  <wsdl:message name='DeleteMetadataMsg' >
+    <wsdl:part name='body' element='tns:DeleteMetadata' />
+  </wsdl:message>
+  <wsdl:message name='DeleteMetadataResponseMsg' >
+    <wsdl:part name='body' element='tns:DeleteMetadataResponse' />
+  </wsdl:message>
+
+  <wsdl:portType name='MetadataExchange' >
+
+    <wsdl:operation name='GetWSDL'>
+      <wsdl:input
+       message='tns:GetWSDLMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/GetWSDL'/>
+      <wsdl:output
+       message='tns:GetWSDLResponseMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/GetWSDLResponse'/>
+    </wsdl:operation>
+
+    <wsdl:operation name='GetMetadata' >
+      <wsdl:input
+       message='tns:GetMetadataMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/GetMetadata'/>
+      <wsdl:output
+       message='tns:GetMetadataResponseMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/GetMetadataResponse'/>
+    </wsdl:operation>
+
+    <wsdl:operation name='PutMetadata' >
+      <wsdl:input
+       message='tns:PutMetadataMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/PutMetadata'/>
+      <wsdl:output
+       message='tns:PutMetadataResponseMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/PutMetadataResponse'/>
+    </wsdl:operation>
+
+    <wsdl:operation name='DeleteMetadata' >
+      <wsdl:input
+       message='tns:DeleteMetadataMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/DeleteMetadata'/>
+      <wsdl:output
+       message='tns:DeleteMetadataResponseMsg'
+       wsam:Action=
+        'http://www.w3.org/2009/09/ws-mex/DeleteMetadataResponse'/>
+    </wsdl:operation>
+
+  </wsdl:portType>
+
+</wsdl:definitions>

Propchange: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/ws/mex/src/main/model/metadataexchange.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml