cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r737994 - in /cxf/trunk: rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ tools/wsdlto/core/src/main/java/org/apache/cxf/tool...
Date Tue, 27 Jan 2009 04:07:05 GMT
Author: dkulp
Date: Tue Jan 27 04:07:04 2009
New Revision: 737994

URL: http://svn.apache.org/viewvc?rev=737994&view=rev
Log:
[CXF-1920] Fix issue of unknown bindings causing exceptions even if binding isn't used
At startup, only process the binding for the requested endpoint, not all of them.

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties?rev=737994&r1=737993&r2=737994&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/Messages.properties Tue Jan 27 04:07:04
2009
@@ -27,6 +27,6 @@
 SERVICE_CREATION_MSG = Failed to create service.
 NO_SUCH_SERVICE_EXC = Could not find definition for service {0}.
 FAIL_TO_CREATE_WSDL_DEFINITION = Fail to create wsdl definition from : {0}\r\nCaused by :
{1} 
-MISSING_DESTINATION_FACTORY = Cannot find the destination factory, check the port //wsdl:port[@name='{0}']
+MISSING_DESTINATION_FACTORY = Cannot find the destination factory, check the port //wsdl:port[@name=''{0}'']
 MISSING_SERVICE= No definition of service {0} in the WSDL.
 WSDL4J_BAD_ELEMENT_PART= Part {0} defined as element {1} which is not in the schema.

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=737994&r1=737993&r2=737994&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Tue Jan
27 04:07:04 2009
@@ -104,6 +104,7 @@
     private Bus bus;
     private Map<String, Element> schemaList = new HashMap<String, Element>();
     private boolean recordOriginal = true;
+    private boolean ignoreUnknownBindings;
 
     public WSDLServiceBuilder(Bus bus) {
         this.bus = bus;
@@ -113,6 +114,10 @@
         recordOriginal = record;
     }
 
+    public void setIgnoreUnknownBindings(boolean b) {
+        ignoreUnknownBindings = b;
+    }
+    
     private void copyExtensors(AbstractPropertiesHolder info, List<?> extList) {
         if (info != null) {
             for (ExtensibilityElement ext : cast(extList, ExtensibilityElement.class)) {
@@ -145,16 +150,22 @@
         for (java.util.Iterator<QName> ite = CastUtils.cast(d.getServices().keySet().iterator());
ite
             .hasNext();) {
             QName qn = ite.next();
-            serviceList.addAll(buildServices(d, qn, description));
+            serviceList.addAll(buildServices(d, qn, null, description));
         }
         return serviceList;
     }
 
     public List<ServiceInfo> buildServices(Definition d, QName name) {
-        return buildServices(d, name, null);
+        return buildServices(d, name, null, null);
+    }
+    public List<ServiceInfo> buildServices(Definition d, QName name, QName endpointName)
{
+        return buildServices(d, name, endpointName);
     }
 
-    private List<ServiceInfo> buildServices(Definition d, QName name, DescriptionInfo
description) {
+    private List<ServiceInfo> buildServices(Definition d, 
+                                            QName name,
+                                            QName endpointName,
+                                            DescriptionInfo description) {
         Service service = d.getService(name);
         if (service == null) {
             org.apache.cxf.common.i18n.Message msg = 
@@ -163,11 +174,14 @@
                                                        name);
             throw new WSDLRuntimeException(msg);
         }
-        return buildServices(d, service, description);
+        return buildServices(d, service, endpointName, description);
     }
 
     public List<ServiceInfo> buildServices(Definition def, Service serv) {
-        return buildServices(def, serv, null);
+        return buildServices(def, serv, null, null);
+    }
+    public List<ServiceInfo> buildServices(Definition def, Service serv, QName endpointName)
{
+        return buildServices(def, serv, endpointName, null);
     }
 
     public List<ServiceInfo> buildMockServices(Definition d) {
@@ -233,7 +247,10 @@
         return service;
     }
 
-    private List<ServiceInfo> buildServices(Definition def, Service serv, DescriptionInfo
d) {
+    private List<ServiceInfo> buildServices(Definition def,
+                                            Service serv, 
+                                            QName endpointName, 
+                                            DescriptionInfo d) {
         Map<QName, ServiceInfo> services = new LinkedHashMap<QName, ServiceInfo>();
 
         DescriptionInfo description = d;
@@ -263,6 +280,10 @@
             }
         }
         for (Port port : cast(serv.getPorts().values(), Port.class)) {
+            if (endpointName != null
+                && !endpointName.getLocalPart().equals(port.getName())) {
+                continue;
+            }
             Binding binding = port.getBinding();
             PortType bindingPt = binding.getPortType();
             if (bindingPt == null) {
@@ -395,7 +416,9 @@
                 }
             }
             if (ns == null) {
-                
+                if (ignoreUnknownBindings) {
+                    return null;
+                }
                 org.apache.cxf.common.i18n.Message msg = new 
                     org.apache.cxf.common.i18n.Message("MISSING_DESTINATION_FACTORY",
                                                        LOG,

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java?rev=737994&r1=737993&r2=737994&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceFactory.java Tue Jan
27 04:07:04 2009
@@ -45,6 +45,7 @@
 
     private URL wsdlUrl;
     private QName serviceName;
+    private QName endpointName;
     private Definition definition;
 
     public WSDLServiceFactory(Bus b, Definition d) {
@@ -94,7 +95,9 @@
 
         serviceName = sn;
     }
-
+    public void setEndpointName(QName qn) {
+        endpointName = qn;
+    }
     public Service create() {
 
         List<ServiceInfo> services;
@@ -123,7 +126,9 @@
                 throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC",
LOG, serviceName));
             }
             try {
-                services = new WSDLServiceBuilder(getBus()).buildServices(definition, wsdlService);
+                services = new WSDLServiceBuilder(getBus()).buildServices(definition, 
+                                                                          wsdlService,
+                                                                          endpointName);
             } catch (XmlSchemaException ex) {
                 throw new ServiceConstructionException(new Message("SERVICE_CREATION_MSG",
LOG), ex);
             }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=737994&r1=737993&r2=737994&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Tue Jan
27 04:07:04 2009
@@ -280,6 +280,7 @@
             checkProperties();
 
             // Initialize the endpointName so we can do configureObject
+            QName origEpn = endpointName;
             if (endpointName == null) {
                 JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(getImplementorClass());
                 endpointName = implInfo.getEndpointName();
@@ -294,6 +295,7 @@
             }*/
 
             configureObject(this);
+            endpointName = origEpn;
             
             // Set up the server factory
             serverFactory.setAddress(addr);

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=737994&r1=737993&r2=737994&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Tue Jan 27 04:07:04 2009
@@ -54,6 +54,7 @@
 import org.apache.cxf.BusException;
 import org.apache.cxf.binding.BindingFactoryManager;
 import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
+import org.apache.cxf.clustering.FailoverFeature;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -309,6 +310,17 @@
         }
         populateFromClass = false;
         WSDLServiceFactory factory = new WSDLServiceFactory(getBus(), url, getServiceQName());
+        boolean setEPName = true;
+        if (features != null) {
+            for (AbstractFeature f : features) {
+                if (f instanceof FailoverFeature) {
+                    setEPName = false;
+                }
+            }
+        }
+        if (setEPName) {
+            factory.setEndpointName(getEndpointName(false));
+        }
         setService(factory.create());
 
         setServiceProperties();

Modified: cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java?rev=737994&r1=737993&r2=737994&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
(original)
+++ cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/WSDLToJavaContainer.java
Tue Jan 27 04:07:04 2009
@@ -105,8 +105,7 @@
             FrontEndProfile frontend = context.get(FrontEndProfile.class);
 
             if (frontend == null) {
-                Message msg = new Message("FOUND_NO_FRONTEND", LOG);
-                throw new ToolException(msg);
+                throw new ToolException(new Message("FOUND_NO_FRONTEND", LOG));
             }
 
             WSDLConstants.WSDLVersion version = getWSDLVersion();
@@ -133,6 +132,7 @@
                     builder.validate(definition);
 
                     WSDLServiceBuilder serviceBuilder = new WSDLServiceBuilder(getBus());
+                    serviceBuilder.setIgnoreUnknownBindings(true);
                     String serviceName = (String)context.get(ToolConstants.CFG_SERVICENAME);
 
                     if (serviceName != null) {



Mime
View raw message