tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r593641 [2/2] - in /openejb/trunk/openejb3: assembly/openejb-tomcat/src/main/java/org/apache/openejb/tomcat/ container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/java/org/apache/openejb/...
Date Fri, 09 Nov 2007 20:30:53 GMT
Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ProviderWrapper.java Fri Nov  9 12:30:50 2007
@@ -31,6 +31,7 @@
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.namespace.QName;
 import javax.xml.bind.JAXBContext;
+import javax.jws.WebService;
 import java.net.URL;
 import java.util.Iterator;
 import java.util.Map;
@@ -68,6 +69,8 @@
             System.setProperty(JAXWSPROVIDER_PROPERTY, ProviderWrapper.class.getName());
         }
 
+        System.setProperty(JAXWSPROVIDER_PROPERTY, ProviderWrapper.class.getName());
+        
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         if (oldClassLoader != null) {
             Thread.currentThread().setContextClassLoader(new ProviderClassLoader(oldClassLoader));
@@ -132,13 +135,24 @@
 
         public <T> T getPort(QName portName, Class<T> serviceEndpointInterface) {
             T t = serviceDelegate.getPort(portName, serviceEndpointInterface);
-            setProperties((BindingProvider) t);
+            setProperties((BindingProvider) t, portName);
             return t;
         }
 
         public <T> T getPort(Class<T> serviceEndpointInterface) {
             T t = serviceDelegate.getPort(serviceEndpointInterface);
-            setProperties((BindingProvider) t);
+
+            QName qname = null;
+            if (serviceEndpointInterface.isAnnotationPresent(WebService.class)) {
+                WebService webService = serviceEndpointInterface.getAnnotation(WebService.class);
+                String targetNamespace = webService.targetNamespace();
+                String name = webService.name();
+                if (targetNamespace != null && targetNamespace.length() > 0 && name != null && name.length() > 0) {
+                    qname = new QName(targetNamespace, name);
+                }
+            }
+
+            setProperties((BindingProvider) t, qname);
             return t;
         }
 
@@ -148,13 +162,13 @@
 
         public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Service.Mode mode) {
             Dispatch<T> dispatch = serviceDelegate.createDispatch(portName, type, mode);
-            setProperties(dispatch);
+            setProperties(dispatch, portName);
             return dispatch;
         }
 
         public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Service.Mode mode) {
             Dispatch<Object> dispatch = serviceDelegate.createDispatch(portName, context, mode);
-            setProperties(dispatch);
+            setProperties(dispatch, portName);
             return dispatch;
         }
 
@@ -191,9 +205,21 @@
             serviceDelegate.setExecutor(executor);
         }
 
-        private void setProperties(BindingProvider proxy) {
+        private void setProperties(BindingProvider proxy, QName qname) {
             for (PortRefData portRef : portRefs) {
-                if (portRef.getServiceEndpointInterface().isInstance(proxy)) {
+                Class intf = null;
+                if (portRef.getServiceEndpointInterface() != null) {
+                    try {
+                        intf = proxy.getClass().getClassLoader().loadClass(portRef.getServiceEndpointInterface());
+                    } catch (Exception e) {
+                    }
+                }
+                if ((qname != null && qname.equals(portRef.getQName())) || (intf != null && intf.isInstance(proxy))) {
+                    // set address
+                    if (!portRef.getAddresses().isEmpty()) {
+                        proxy.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, portRef.getAddresses().get(0));
+                    }
+
                     // set mtom
                     boolean enableMTOM = portRef.isEnableMtom();
                     if (enableMTOM && proxy.getBinding() instanceof SOAPBinding) {
@@ -283,6 +309,19 @@
             return provider;
         }
 
+
+        // 4. Use javax.xml.ws.spi.Provider default
+        try {
+            System.getProperties().remove(JAXWSPROVIDER_PROPERTY);
+            provider = Provider.provider();
+            if (provider != null && !provider.getClass().getName().equals(ProviderWrapper.class.getName())) {
+                return provider;
+            }
+        } finally {
+            // restore original jax provider property
+            System.setProperty(JAXWSPROVIDER_PROPERTY, providerClass);
+        }
+
         throw new WebServiceException("No " + JAXWSPROVIDER_PROPERTY + " implementation found");
     }
 
@@ -304,6 +343,7 @@
         static {
             try {
                 File tempFile = File.createTempFile("openejb-jaxws-provider", "tmp");
+                tempFile.deleteOnExit();
                 OutputStream out = new FileOutputStream(tempFile);
                 out.write(ProviderWrapper.class.getName().getBytes());
                 out.close();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ServiceRefData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ServiceRefData.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ServiceRefData.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/webservices/ServiceRefData.java Fri Nov  9 12:30:50 2007
@@ -35,19 +35,21 @@
         return registry.put(key, value);
     }
 
+    private final String id;
+    private final QName serviceQName;
     private final Class<? extends Service> serviceClass;
+    private final QName portQName;
     private final Class<?> referenceClass;
     private final URL wsdlURL;
-    private final QName serviceQName;
-    private final String portId;
     private final List<HandlerChainData> handlerChains = new ArrayList<HandlerChainData>();
     private final List<PortRefData> portRefs = new ArrayList<PortRefData>();
 
-    public ServiceRefData(String portId, Class<? extends Service> serviceClass, Class<?> referenceClass, URL wsdlURL, QName serviceQName, List<HandlerChainData> handlerChains, List<PortRefData> portRefs) {
-        this.portId = portId;
+    public ServiceRefData(String id, QName serviceQName, Class<? extends Service> serviceClass, QName portQName, Class<?> referenceClass, URL wsdlURL, List<HandlerChainData> handlerChains, List<PortRefData> portRefs) {
+        this.id = id;
+        this.serviceQName = serviceQName;
         this.serviceClass = serviceClass;
+        this.portQName = portQName;
         this.referenceClass = referenceClass;
-        this.serviceQName = serviceQName;
         this.wsdlURL = wsdlURL;
         if (handlerChains != null) {
             this.handlerChains.addAll(handlerChains);
@@ -57,24 +59,28 @@
         }
     }
 
-    public String getPortId() {
-        return portId;
+    public String getId() {
+        return id;
+    }
+
+    public QName getServiceQName() {
+        return serviceQName;
     }
 
     public Class<? extends Service> getServiceClass() {
         return serviceClass;
     }
 
+    public QName getPortQName() {
+        return portQName;
+    }
+
     public Class<?> getReferenceClass() {
         return referenceClass;
     }
 
     public URL getWsdlURL() {
         return wsdlURL;
-    }
-
-    public QName getServiceQName() {
-        return serviceQName;
     }
 
     public List<HandlerChainData> getHandlerChains() {

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/SunConversionTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/SunConversionTest.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/SunConversionTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/SunConversionTest.java Fri Nov  9 12:30:50 2007
@@ -17,58 +17,57 @@
  */
 package org.apache.openejb.config;
 
-import static org.apache.openejb.config.SunConversion.extractPortId;
 import junit.framework.TestCase;
 
 public class SunConversionTest extends TestCase {
     public void testExtractPortId() throws Exception {
-        assertEquals("dir/file", extractPortId("file:repo1/dir", "META-INF/wsdl/file.wsdl"));
-        assertEquals("dir/file", extractPortId("file:repo1/dir", "WEB-INF/wsdl/file.wsdl"));
-        assertEquals("dir/META-INF/file", extractPortId("file:repo1/dir", "META-INF/file.wsdl"));
-        assertEquals("dir/WEB-INF/file", extractPortId("file:repo1/dir", "WEB-INF/file.wsdl"));
-        assertEquals("dir/file", extractPortId("file:repo1/dir", "file.wsdl"));
-        assertEquals("dir/file.xml", extractPortId("file:repo1/dir", "META-INF/wsdl/file.xml"));
-        assertEquals("dir/file.xml", extractPortId("file:repo1/dir", "WEB-INF/wsdl/file.xml"));
+        assertEquals("dir/file", SunConversion.extractSerivceId("file:repo1/dir", "META-INF/wsdl/file.wsdl"));
+        assertEquals("dir/file", SunConversion.extractSerivceId("file:repo1/dir", "WEB-INF/wsdl/file.wsdl"));
+        assertEquals("dir/META-INF/file", SunConversion.extractSerivceId("file:repo1/dir", "META-INF/file.wsdl"));
+        assertEquals("dir/WEB-INF/file", SunConversion.extractSerivceId("file:repo1/dir", "WEB-INF/file.wsdl"));
+        assertEquals("dir/file", SunConversion.extractSerivceId("file:repo1/dir", "file.wsdl"));
+        assertEquals("dir/file.xml", SunConversion.extractSerivceId("file:repo1/dir", "META-INF/wsdl/file.xml"));
+        assertEquals("dir/file.xml", SunConversion.extractSerivceId("file:repo1/dir", "WEB-INF/wsdl/file.xml"));
 
         String x = "file:repo1/dir";
-        assertEquals("dir", SunConversion.extractPortId(x));
-        assertEquals("dir/file", SunConversion.extractPortId("file:repo1/dir/file.wsdl"));
-        assertEquals("dir/file.xml", SunConversion.extractPortId("file:repo1/dir/file.xml"));
-        assertEquals(null, SunConversion.extractPortId("file:repo1/"));
+        assertEquals("dir", SunConversion.extractServiceId(x));
+        assertEquals("dir/file", SunConversion.extractServiceId("file:repo1/dir/file.wsdl"));
+        assertEquals("dir/file.xml", SunConversion.extractServiceId("file:repo1/dir/file.xml"));
+        assertEquals(null, SunConversion.extractServiceId("file:repo1/"));
 
-        assertEquals("dir/file", SunConversion.extractPortId("http://server.com:port/dir/file?WSDL"));
-        assertEquals("dir/file", SunConversion.extractPortId("http://server.com:port/dir/file?wsdl"));
-        assertEquals("dir/file", SunConversion.extractPortId("http://server.com:port/dir/file?cheese"));
-        assertEquals("dir/file", SunConversion.extractPortId("http://server.com:port/dir/file"));
-        assertEquals("file", SunConversion.extractPortId("http://server.com:port/file?WSDL"));
-        assertEquals("file", SunConversion.extractPortId("http://server.com:port/file?wsdl"));
-        assertEquals("file", SunConversion.extractPortId("http://server.com:port/file?cheese"));
-        assertEquals("file", SunConversion.extractPortId("http://server.com:port/file"));
-        assertEquals(null, SunConversion.extractPortId("http://server.com:port/?WSDL"));
-        assertEquals(null, SunConversion.extractPortId("http://server.com:port/?wsdl"));
-        assertEquals(null, SunConversion.extractPortId("http://server.com:port/?cheese"));
-        assertEquals(null, SunConversion.extractPortId("http://server.com:port/"));
-        assertEquals("dir/file/", SunConversion.extractPortId("http://server.com:port/dir/file/?WSDL"));
-        assertEquals("dir/file/", SunConversion.extractPortId("http://server.com:port/dir/file/?wsdl"));
-        assertEquals("dir/file/", SunConversion.extractPortId("http://server.com:port/dir/file/?cheese"));
-        assertEquals("dir/file/", SunConversion.extractPortId("http://server.com:port/dir/file/"));
-        assertEquals("dir/file", SunConversion.extractPortId("https://server.com:port/dir/file?WSDL"));
-        assertEquals("dir/file", SunConversion.extractPortId("https://server.com:port/dir/file?wsdl"));
-        assertEquals("dir/file", SunConversion.extractPortId("https://server.com:port/dir/file?cheese"));
-        assertEquals("dir/file", SunConversion.extractPortId("https://server.com:port/dir/file"));
-        assertEquals("file", SunConversion.extractPortId("https://server.com:port/file?WSDL"));
-        assertEquals("file", SunConversion.extractPortId("https://server.com:port/file?wsdl"));
-        assertEquals("file", SunConversion.extractPortId("https://server.com:port/file?cheese"));
-        assertEquals("file", SunConversion.extractPortId("https://server.com:port/file"));
-        assertEquals(null, SunConversion.extractPortId("https://server.com:port/?WSDL"));
-        assertEquals(null, SunConversion.extractPortId("https://server.com:port/?wsdl"));
-        assertEquals(null, SunConversion.extractPortId("https://server.com:port/?cheese"));
-        assertEquals(null, SunConversion.extractPortId("https://server.com:port/"));
-        assertEquals("dir/file/", SunConversion.extractPortId("https://server.com:port/dir/file/?WSDL"));
-        assertEquals("dir/file/", SunConversion.extractPortId("https://server.com:port/dir/file/?wsdl"));
-        assertEquals("dir/file/", SunConversion.extractPortId("https://server.com:port/dir/file/?cheese"));
-        assertEquals("dir/file/", SunConversion.extractPortId("https://server.com:port/dir/file/"));
+        assertEquals("dir/file", SunConversion.extractServiceId("http://server.com:port/dir/file?WSDL"));
+        assertEquals("dir/file", SunConversion.extractServiceId("http://server.com:port/dir/file?wsdl"));
+        assertEquals("dir/file", SunConversion.extractServiceId("http://server.com:port/dir/file?cheese"));
+        assertEquals("dir/file", SunConversion.extractServiceId("http://server.com:port/dir/file"));
+        assertEquals("file", SunConversion.extractServiceId("http://server.com:port/file?WSDL"));
+        assertEquals("file", SunConversion.extractServiceId("http://server.com:port/file?wsdl"));
+        assertEquals("file", SunConversion.extractServiceId("http://server.com:port/file?cheese"));
+        assertEquals("file", SunConversion.extractServiceId("http://server.com:port/file"));
+        assertEquals(null, SunConversion.extractServiceId("http://server.com:port/?WSDL"));
+        assertEquals(null, SunConversion.extractServiceId("http://server.com:port/?wsdl"));
+        assertEquals(null, SunConversion.extractServiceId("http://server.com:port/?cheese"));
+        assertEquals(null, SunConversion.extractServiceId("http://server.com:port/"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("http://server.com:port/dir/file/?WSDL"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("http://server.com:port/dir/file/?wsdl"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("http://server.com:port/dir/file/?cheese"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("http://server.com:port/dir/file/"));
+        assertEquals("dir/file", SunConversion.extractServiceId("https://server.com:port/dir/file?WSDL"));
+        assertEquals("dir/file", SunConversion.extractServiceId("https://server.com:port/dir/file?wsdl"));
+        assertEquals("dir/file", SunConversion.extractServiceId("https://server.com:port/dir/file?cheese"));
+        assertEquals("dir/file", SunConversion.extractServiceId("https://server.com:port/dir/file"));
+        assertEquals("file", SunConversion.extractServiceId("https://server.com:port/file?WSDL"));
+        assertEquals("file", SunConversion.extractServiceId("https://server.com:port/file?wsdl"));
+        assertEquals("file", SunConversion.extractServiceId("https://server.com:port/file?cheese"));
+        assertEquals("file", SunConversion.extractServiceId("https://server.com:port/file"));
+        assertEquals(null, SunConversion.extractServiceId("https://server.com:port/?WSDL"));
+        assertEquals(null, SunConversion.extractServiceId("https://server.com:port/?wsdl"));
+        assertEquals(null, SunConversion.extractServiceId("https://server.com:port/?cheese"));
+        assertEquals(null, SunConversion.extractServiceId("https://server.com:port/"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("https://server.com:port/dir/file/?WSDL"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("https://server.com:port/dir/file/?wsdl"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("https://server.com:port/dir/file/?cheese"));
+        assertEquals("dir/file/", SunConversion.extractServiceId("https://server.com:port/dir/file/"));
 
-        assertEquals(null, SunConversion.extractPortId(null));
+        assertEquals(null, SunConversion.extractServiceId(null));
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/Icon.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/Icon.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/Icon.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/Icon.java Fri Nov  9 12:30:50 2007
@@ -54,7 +54,7 @@
     @XmlID
     protected String id;
     @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
-    protected String lang;
+    protected String lang = "en";
 
     public String getSmallIcon() {
         return smallIcon;

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/KeyedCollection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/KeyedCollection.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/KeyedCollection.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/KeyedCollection.java Fri Nov  9 12:30:50 2007
@@ -88,6 +88,9 @@
 
     public boolean add(V value) {
         K key = getKey(value);
+        if (key == null) {
+            throw new NullPointerException("key is null");
+        }
         V oldValue = map.put(key, value);
         return value != oldValue;
     }

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponent.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponent.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponent.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponent.java Fri Nov  9 12:30:50 2007
@@ -53,7 +53,7 @@
     "handler",
     "handlerChains"
 })
-public class PortComponent {
+public class PortComponent implements Keyable<String> {
     protected String description;
     @XmlElement(name = "display-name")
     protected String displayName;
@@ -82,6 +82,10 @@
     @XmlID
     protected String id;
 
+    public String getKey() {
+        return portComponentName;
+    }
+
     public String getDescription() {
         return description;
     }
@@ -164,13 +168,11 @@
 
     public HandlerChains getHandlerChains() {
         // convert the handlers to handler chain
-        if (handlerChains == null) {
+        if (handlerChains == null && handler != null) {
             handlerChains = new HandlerChains();
             HandlerChain handlerChain = new HandlerChain();
-            if (handler != null) {
-                handlerChain.getHandler().addAll(handler);
-                handler.clear();
-            }
+            handlerChain.getHandler().addAll(handler);
+            handler = null;
             handlerChains.getHandlerChain().add(handlerChain);
         }
         return handlerChains;

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponentRef.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponentRef.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponentRef.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/PortComponentRef.java Fri Nov  9 12:30:50 2007
@@ -23,10 +23,11 @@
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlID;
-import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.namespace.QName;
 import java.util.Properties;
 
 
@@ -52,6 +53,8 @@
     @XmlElement(name = "port-component-link")
     protected String portComponentLink;
     @XmlTransient
+    protected QName qname;
+    @XmlTransient
     protected Properties properties;
     @XmlAttribute
     @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@@ -80,6 +83,14 @@
 
     public void setPortComponentLink(String value) {
         this.portComponentLink = value;
+    }
+
+    public QName getQName() {
+        return qname;
+    }
+
+    public void setQName(QName qname) {
+        this.qname = qname;
     }
 
     public Properties getProperties() {

Modified: openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebserviceDescription.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebserviceDescription.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebserviceDescription.java (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/WebserviceDescription.java Fri Nov  9 12:30:50 2007
@@ -21,12 +21,12 @@
 import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlID;
-import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
+import java.util.Map;
 
 /**
  * The webservice-description element defines a WSDL document file
@@ -63,7 +63,7 @@
     @XmlTransient
     protected JavaWsdlMapping jaxrpcMapping;
     @XmlElement(name = "port-component", required = true)
-    protected List<PortComponent> portComponent;
+    protected KeyedCollection<String, PortComponent> portComponent;
     @XmlAttribute
     @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
     @XmlID
@@ -130,11 +130,18 @@
         this.jaxrpcMapping = jaxrpcMapping;
     }
 
-    public List<PortComponent> getPortComponent() {
+    public Collection<PortComponent> getPortComponent() {
         if (portComponent == null) {
-            portComponent = new ArrayList<PortComponent>();
+            portComponent = new KeyedCollection<String,PortComponent>();
         }
         return this.portComponent;
+    }
+
+    public Map<String,PortComponent> getPortComponentMap() {
+        if (portComponent == null) {
+            portComponent = new KeyedCollection<String,PortComponent>();
+        }
+        return this.portComponent.toMap();
     }
 
     public String getId() {

Modified: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-client-example.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-client-example.xml?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-client-example.xml (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-client-example.xml Fri Nov  9 12:30:50 2007
@@ -2,7 +2,7 @@
 <application-client xmlns="http://java.sun.com/xml/ns/javaee" version="3.0" metadata-complete="true">
     <description>String</description>
     <display-name>token</display-name>
-    <icon>
+    <icon xml:lang="en">
         <small-icon>token</small-icon>
         <large-icon>token</large-icon>
     </icon>
@@ -33,7 +33,7 @@
     <service-ref>
         <description>String</description>
         <display-name>token</display-name>
-        <icon>
+        <icon xml:lang="en">
             <small-icon>token</small-icon>
             <large-icon>token</large-icon>
         </icon>
@@ -51,7 +51,7 @@
         <handler>
             <description>String</description>
             <display-name>token</display-name>
-            <icon>
+            <icon xml:lang="en">
                 <small-icon>token</small-icon>
                 <large-icon>token</large-icon>
             </icon>
@@ -128,7 +128,7 @@
     <message-destination>
         <description>String</description>
         <display-name>token</display-name>
-        <icon>
+        <icon xml:lang="en">
             <small-icon>token</small-icon>
             <large-icon>token</large-icon>
         </icon>

Modified: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-example.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-example.xml?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-example.xml (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/resources/application-example.xml Fri Nov  9 12:30:50 2007
@@ -2,7 +2,7 @@
 <application xmlns="http://java.sun.com/xml/ns/javaee" version="3.0">
     <description>String</description>
     <display-name>token</display-name>
-    <icon>
+    <icon xml:lang="en">
         <small-icon>token</small-icon>
         <large-icon>token</large-icon>
     </icon>

Modified: openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-example1.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-example1.xml?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-example1.xml (original)
+++ openejb/trunk/openejb3/container/openejb-jee/src/test/resources/ejb-jar-example1.xml Fri Nov  9 12:30:50 2007
@@ -2,7 +2,7 @@
 <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0" metadata-complete="true">
     <description>String</description>
     <display-name>token</display-name>
-    <icon>
+    <icon xml:lang="en">
         <small-icon>token</small-icon>
         <large-icon>token</large-icon>
     </icon>
@@ -54,7 +54,7 @@
         <session>
             <description>String</description>
             <display-name>token</display-name>
-            <icon>
+            <icon xml:lang="en">
                 <small-icon>token</small-icon>
                 <large-icon>token</large-icon>
             </icon>
@@ -145,7 +145,7 @@
             <service-ref>
                 <description>String</description>
                 <display-name>token1</display-name>
-                <icon>
+                <icon xml:lang="en">
                     <small-icon>token1</small-icon>
                     <large-icon>token1</large-icon>
                 </icon>
@@ -163,7 +163,7 @@
                 <handler>
                     <description>String</description>
                     <display-name>token</display-name>
-                    <icon>
+                    <icon xml:lang="en">
                         <small-icon>token</small-icon>
                         <large-icon>token</large-icon>
                     </icon>
@@ -187,7 +187,7 @@
             <service-ref>
                 <description>String</description>
                 <display-name>token2</display-name>
-                <icon>
+                <icon xml:lang="en">
                     <small-icon>token2</small-icon>
                     <large-icon>token2</large-icon>
                 </icon>
@@ -204,7 +204,7 @@
                 <handler>
                     <description>String</description>
                     <display-name>token</display-name>
-                    <icon>
+                    <icon xml:lang="en">
                         <small-icon>token</small-icon>
                         <large-icon>token</large-icon>
                     </icon>
@@ -360,7 +360,7 @@
             <service-ref>
                 <description>String</description>
                 <display-name>token</display-name>
-                <icon>
+                <icon xml:lang="en">
                     <small-icon>token</small-icon>
                     <large-icon>token</large-icon>
                 </icon>
@@ -378,7 +378,7 @@
                 <handler>
                     <description>String</description>
                     <display-name>token</display-name>
-                    <icon>
+                    <icon xml:lang="en">
                         <small-icon>token</small-icon>
                         <large-icon>token</large-icon>
                     </icon>
@@ -559,7 +559,7 @@
         <message-destination>
             <description>String</description>
             <display-name>token</display-name>
-            <icon>
+            <icon xml:lang="en">
                 <small-icon>token</small-icon>
                 <large-icon>token</large-icon>
             </icon>

Added: openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ClientHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ClientHandler.java?rev=593641&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ClientHandler.java (added)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ClientHandler.java Fri Nov  9 12:30:50 2007
@@ -0,0 +1,37 @@
+/**
+ *
+ * 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.openejb.examples.servlet;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+public class ClientHandler implements Handler {
+    public boolean handleMessage(MessageContext messageContext) {
+        WebserviceServlet.write("    ClientHandler handleMessage");
+        return true;
+    }
+
+    public void close(MessageContext messageContext) {
+        WebserviceServlet.write("    ClientHandler close");
+    }
+
+    public boolean handleFault(MessageContext messageContext) {
+        WebserviceServlet.write("    ClientHandler handleFault");
+        return true;
+    }
+}
\ No newline at end of file

Modified: openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloEjbService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloEjbService.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloEjbService.java (original)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloEjbService.java Fri Nov  9 12:30:50 2007
@@ -18,6 +18,7 @@
 package org.apache.openejb.examples.servlet;
 
 import javax.jws.WebService;
+import javax.jws.HandlerChain;
 import javax.ejb.Stateless;
 
 @WebService(
@@ -26,9 +27,11 @@
     targetNamespace="http://examples.org/wsdl",
     endpointInterface="org.apache.openejb.examples.servlet.HelloEjb"
 )
+@HandlerChain(file = "server-handlers.xml")
 @Stateless
 public class HelloEjbService implements HelloEjb {
     public String hello(String name) {
+        WebserviceServlet.write("                HelloEjbService hello(" + name + ")");
         if (name == null) name = "World";
         return "Hello " + name + " from EJB Webservice!";
     }

Modified: openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloPojoService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloPojoService.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloPojoService.java (original)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/HelloPojoService.java Fri Nov  9 12:30:50 2007
@@ -18,6 +18,7 @@
 package org.apache.openejb.examples.servlet;
 
 import javax.jws.WebService;
+import javax.jws.HandlerChain;
 
 @WebService(
     portName="HelloPojoPort",
@@ -25,8 +26,10 @@
     targetNamespace="http://examples.org/wsdl",
     endpointInterface="org.apache.openejb.examples.servlet.HelloPojo"
 )
+@HandlerChain(file = "server-handlers.xml")
 public class HelloPojoService implements HelloPojo {
     public String hello(String name) {
+        WebserviceServlet.write("                HelloPojoService hello(" + name + ")");
         if (name == null) name = "World";
         return "Hello " + name + " from Pojo Webservice!";
     }

Added: openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ServerHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ServerHandler.java?rev=593641&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ServerHandler.java (added)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/ServerHandler.java Fri Nov  9 12:30:50 2007
@@ -0,0 +1,37 @@
+/**
+ *
+ * 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.openejb.examples.servlet;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+public class ServerHandler implements Handler {
+    public boolean handleMessage(MessageContext messageContext) {
+        WebserviceServlet.write("        ServerHandler handleMessage");
+        return true;
+    }
+
+    public void close(MessageContext messageContext) {
+        WebserviceServlet.write("        ServerHandler close");
+    }
+
+    public boolean handleFault(MessageContext messageContext) {
+        WebserviceServlet.write("        ServerHandler handleFault");
+        return true;
+    }
+}

Modified: openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/WebserviceServlet.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/WebserviceServlet.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/WebserviceServlet.java (original)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/java/org/apache/openejb/examples/servlet/WebserviceServlet.java Fri Nov  9 12:30:50 2007
@@ -23,26 +23,47 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.ws.WebServiceRef;
+import javax.jws.HandlerChain;
 import java.io.IOException;
 
 public class WebserviceServlet extends HttpServlet {
+
     @WebServiceRef
+    @HandlerChain(file = "client-handlers.xml")
     private HelloPojo helloPojo;
 
     @WebServiceRef
+    @HandlerChain(file = "client-handlers.xml")
     private HelloEjb helloEjb;
 
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         response.setContentType("text/plain");
         ServletOutputStream out = response.getOutputStream();
 
-        out.println("Pojo Webservice");
-        out.println("    helloPojo.hello(\"Bob\")=" + helloPojo.hello("Bob"));
-        out.println("    helloPojo.hello(null)=" + helloPojo.hello(null));
-        out.println();
-        out.println("EJB Webservice");
-        out.println("    helloEjb.hello(\"Bob\")=" + helloEjb.hello("Bob"));
-        out.println("    helloEjb.hello(null)=" + helloEjb.hello(null));
-        out.println();
+        OUT = out;
+        try {
+            out.println("Pojo Webservice");
+            out.println("    helloPojo.hello(\"Bob\")=" + helloPojo.hello("Bob"));
+            out.println();
+            out.println("    helloPojo.hello(null)=" + helloPojo.hello(null));
+            out.println();
+            out.println("EJB Webservice");
+            out.println("    helloEjb.hello(\"Bob\")=" + helloEjb.hello("Bob"));
+            out.println();
+            out.println("    helloEjb.hello(null)=" + helloEjb.hello(null));
+            out.println();
+        } finally {
+            OUT = out;
+        }
+    }
+
+    private static ServletOutputStream OUT;
+    public static void write(String message) {
+        try {
+            ServletOutputStream out = OUT;
+            out.println(message);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 }

Added: openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/client-handlers.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/client-handlers.xml?rev=593641&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/client-handlers.xml (added)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/client-handlers.xml Fri Nov  9 12:30:50 2007
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!-- $Rev: 482336 $ $Date: 2006-12-04 15:12:19 -0500 (Mon, 04 Dec 2006) $ -->
+
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+    <jws:handler-chain>
+        <jws:handler>
+            <jws:handler-name>ClientHandler</jws:handler-name>
+            <jws:handler-class>org.apache.openejb.examples.servlet.ClientHandler</jws:handler-class>
+        </jws:handler>
+    </jws:handler-chain>
+</jws:handler-chains>

Added: openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/server-handlers.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/server-handlers.xml?rev=593641&view=auto
==============================================================================
--- openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/server-handlers.xml (added)
+++ openejb/trunk/openejb3/examples/ejb-examples/src/main/resources/org/apache/openejb/examples/servlet/server-handlers.xml Fri Nov  9 12:30:50 2007
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!-- $Rev: 482336 $ $Date: 2006-12-04 15:12:19 -0500 (Mon, 04 Dec 2006) $ -->
+
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+    <jws:handler-chain>
+        <jws:handler>
+            <jws:handler-name>ServerHandler</jws:handler-name>
+            <jws:handler-class>org.apache.openejb.examples.servlet.ServerHandler</jws:handler-class>
+        </jws:handler>
+    </jws:handler-chain>
+</jws:handler-chains>

Modified: openejb/trunk/openejb3/server/openejb-client/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/pom.xml?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/pom.xml (original)
+++ openejb/trunk/openejb3/server/openejb-client/pom.xml Fri Nov  9 12:30:50 2007
@@ -58,6 +58,11 @@
       <artifactId>geronimo-ejb_3.0_spec</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
       <groupId>org.apache.geronimo.javamail</groupId>
       <artifactId>geronimo-javamail_1.4_mail</artifactId>
       <optional>true</optional>

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/JaxWsProviderWrapper.java Fri Nov  9 12:30:50 2007
@@ -28,6 +28,7 @@
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.namespace.QName;
 import javax.xml.bind.JAXBContext;
+import javax.jws.WebService;
 import java.net.URL;
 import java.util.Iterator;
 import java.util.Map;
@@ -64,9 +65,10 @@
         String oldProperty = System.getProperty(JAXWSPROVIDER_PROPERTY);
         if (oldProperty != null && !oldProperty.equals(JaxWsProviderWrapper.class.getName())) {
             System.setProperty("openejb." + JAXWSPROVIDER_PROPERTY, oldProperty);
-            System.setProperty(JAXWSPROVIDER_PROPERTY, JaxWsProviderWrapper.class.getName());
         }
 
+        System.setProperty(JAXWSPROVIDER_PROPERTY, JaxWsProviderWrapper.class.getName());
+
         ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         if (oldClassLoader != null) {
             Thread.currentThread().setContextClassLoader(new ProviderClassLoader(oldClassLoader));
@@ -131,13 +133,24 @@
 
         public <T> T getPort(QName portName, Class<T> serviceEndpointInterface) {
             T t = serviceDelegate.getPort(portName, serviceEndpointInterface);
-            setProperties((BindingProvider) t);
+            setProperties((BindingProvider) t, portName);
             return t;
         }
 
         public <T> T getPort(Class<T> serviceEndpointInterface) {
             T t = serviceDelegate.getPort(serviceEndpointInterface);
-            setProperties((BindingProvider) t);
+
+            QName qname = null;
+            if (serviceEndpointInterface.isAnnotationPresent(WebService.class)) {
+                WebService webService = serviceEndpointInterface.getAnnotation(WebService.class);
+                String targetNamespace = webService.targetNamespace();
+                String name = webService.name();
+                if (targetNamespace != null && targetNamespace.length() > 0 && name != null && name.length() > 0) {
+                    qname = new QName(targetNamespace, name);
+                }
+            }
+
+            setProperties((BindingProvider) t, qname);
             return t;
         }
 
@@ -147,13 +160,13 @@
 
         public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Service.Mode mode) {
             Dispatch<T> dispatch = serviceDelegate.createDispatch(portName, type, mode);
-            setProperties(dispatch);
+            setProperties(dispatch, portName);
             return dispatch;
         }
 
         public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Service.Mode mode) {
             Dispatch<Object> dispatch = serviceDelegate.createDispatch(portName, context, mode);
-            setProperties(dispatch);
+            setProperties(dispatch, portName);
             return dispatch;
         }
 
@@ -190,14 +203,21 @@
             serviceDelegate.setExecutor(executor);
         }
 
-        private void setProperties(BindingProvider proxy) {
+        private void setProperties(BindingProvider proxy, QName qname) {
             for (PortRefMetaData portRef : portRefs) {
                 Class<?> intf = null;
-                try {
-                    intf = proxy.getClass().getClassLoader().loadClass(portRef.getServiceEndpointInterface());
-                } catch (ClassNotFoundException e) {
+                if (portRef.getServiceEndpointInterface() != null) {
+                    try {
+                        intf = proxy.getClass().getClassLoader().loadClass(portRef.getServiceEndpointInterface());
+                    } catch (ClassNotFoundException e) {
+                    }
                 }
-                if (intf != null && intf.isInstance(proxy)) {
+                if ((qname != null && qname.equals(portRef.getQName())) || (intf != null && intf.isInstance(proxy))) {
+                    // set address
+                    if (!portRef.getAddresses().isEmpty()) {
+                        proxy.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, portRef.getAddresses().get(0));
+                    }
+
                     // set mtom
                     boolean enableMTOM = portRef.isEnableMtom();
                     if (enableMTOM && proxy.getBinding() instanceof SOAPBinding) {
@@ -287,6 +307,26 @@
             return provider;
         }
 
+        // 4. Use javax.xml.ws.spi.Provider default
+        try {
+            // disable the OpenEJB JaxWS provider
+            if (classLoader instanceof ProviderClassLoader) {
+                ((ProviderClassLoader) classLoader).enabled = false;
+            }
+            System.getProperties().remove(JAXWSPROVIDER_PROPERTY);
+
+            provider = Provider.provider();
+            if (provider != null && !provider.getClass().getName().equals(JaxWsProviderWrapper.class.getName())) {
+                return provider;
+            }
+        } finally {
+            // reenable the OpenEJB JaxWS provider
+            System.setProperty(JAXWSPROVIDER_PROPERTY, providerClass);
+            if (classLoader instanceof ProviderClassLoader) {
+                ((ProviderClassLoader) classLoader).enabled = true;
+            }
+        }
+
         throw new WebServiceException("No " + JAXWSPROVIDER_PROPERTY + " implementation found");
     }
 
@@ -308,6 +348,7 @@
         static {
             try {
                 File tempFile = File.createTempFile("openejb-jaxws-provider", "tmp");
+                tempFile.deleteOnExit();
                 OutputStream out = new FileOutputStream(tempFile);
                 out.write(JaxWsProviderWrapper.class.getName().getBytes());
                 out.close();
@@ -317,6 +358,8 @@
             }
         }
 
+        public boolean enabled = true;
+
         public ProviderClassLoader() {
         }
 
@@ -326,7 +369,7 @@
 
         public Enumeration<URL> getResources(String name) throws IOException {
             Enumeration<URL> resources = super.getResources(name);
-            if (PROVIDER_RESOURCE.equals(name)) {
+            if (enabled && PROVIDER_RESOURCE.equals(name)) {
                 ArrayList<URL> list = new ArrayList<URL>();
                 list.add(PROVIDER_URL);
                 list.addAll(Collections.list(resources));
@@ -337,7 +380,7 @@
 
 
         public URL getResource(String name) {
-            if (PROVIDER_RESOURCE.equals(name)) {
+            if (enabled && PROVIDER_RESOURCE.equals(name)) {
                 return PROVIDER_URL;
             }
             return super.getResource(name);

Modified: openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java (original)
+++ openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/PortRefMetaData.java Fri Nov  9 12:30:50 2007
@@ -17,17 +17,28 @@
  */
 package org.apache.openejb.client;
 
+import javax.xml.namespace.QName;
+import java.io.Serializable;
 import java.util.Properties;
 import java.util.List;
-import java.io.Serializable;
+import java.util.ArrayList;
 
 public class PortRefMetaData implements Serializable {
     private static final long serialVersionUID = 4343767807431809218L;
 
+    private QName qname;
     private String serviceEndpointInterface;
     private boolean enableMtom;
-    private String portComponentLink;
     private final Properties properties = new Properties();
+    private final List<String> addresses = new ArrayList<String>(1);
+
+    public QName getQName() {
+        return qname;
+    }
+
+    public void setQName(QName qname) {
+        this.qname = qname;
+    }
 
     public String getServiceEndpointInterface() {
         return serviceEndpointInterface;
@@ -45,15 +56,11 @@
         this.enableMtom = value;
     }
 
-    public String getPortComponentLink() {
-        return portComponentLink;
-    }
-
-    public void setPortComponentLink(String value) {
-        this.portComponentLink = value;
-    }
-
     public Properties getProperties() {
         return properties;
+    }
+
+    public List<String> getAddresses() {
+        return addresses;
     }
 }

Modified: openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java (original)
+++ openejb/trunk/openejb3/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java Fri Nov  9 12:30:50 2007
@@ -22,6 +22,7 @@
 import org.apache.openejb.core.webservices.PortData;
 import org.apache.openejb.server.cxf.ejb.EjbWsContainer;
 import org.apache.openejb.server.cxf.pojo.PojoWsContainer;
+import org.apache.openejb.server.cxf.client.SaajInterceptor;
 import org.apache.openejb.server.httpd.HttpListener;
 import org.apache.openejb.server.webservices.WsService;
 
@@ -32,6 +33,10 @@
 
 public class CxfService extends WsService {
     private final Map<String, CxfWsContainer> wsContainers = new TreeMap<String, CxfWsContainer>();
+
+    public CxfService() {
+        SaajInterceptor.registerInterceptors();
+    }
 
     public String getName() {
         return "cxf";

Modified: openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java (original)
+++ openejb/trunk/openejb3/server/openejb-ejbd/src/main/java/org/apache/openejb/server/ejbd/JndiRequestHandler.java Fri Nov  9 12:30:50 2007
@@ -19,14 +19,16 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.List;
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
 import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.MalformedURLException;
 
 import javax.naming.Context;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
 import javax.jms.ConnectionFactory;
+import javax.xml.namespace.QName;
 
 import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.ProxyInfo;
@@ -39,7 +41,8 @@
 import org.apache.openejb.core.webservices.HandlerChainData;
 import org.apache.openejb.core.webservices.HandlerData;
 import org.apache.openejb.core.webservices.PortRefData;
-import org.apache.openejb.core.webservices.WsdlRepo;
+import org.apache.openejb.core.webservices.PortAddressRegistry;
+import org.apache.openejb.core.webservices.PortAddress;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.spi.ContainerSystem;
 import org.apache.openejb.client.EJBMetaDataImpl;
@@ -103,7 +106,7 @@
             String name = req.getRequestString();
             if (name.startsWith("/")) name = name.substring(1);
 
-            Object object = null;
+            Object object;
             try {
                 if (req.getModuleId() != null && req.getModuleId().equals("openejb/Deployment")){
 
@@ -184,26 +187,28 @@
                     }
                     serviceMetaData.setReferenceClassName(referenceClassName);
 
+                    // set service qname
+                    if (serviceRef.getServiceQName() != null) {
+                        serviceMetaData.setServiceQName(serviceRef.getServiceQName().toString());
+                    }
+
+                    // get the port addresses for this service
+                    PortAddressRegistry portAddressRegistry = SystemInstance.get().getComponent(PortAddressRegistry.class);
+                    Set<PortAddress> portAddresses = null;
+                    if (portAddressRegistry != null) {
+                        portAddresses = portAddressRegistry.getPorts(serviceRef.getId(), serviceRef.getServiceQName());
+                    }
+
                     // resolve the wsdl url
-                    String wsdlUrl = null;
                     if (serviceRef.getWsdlURL() != null) {
-                        wsdlUrl = serviceRef.getWsdlURL().toExternalForm();
+                        serviceMetaData.setWsdlUrl(serviceRef.getWsdlURL().toExternalForm());
                     }
-                    WsdlRepo wsdlRepo = SystemInstance.get().getComponent(WsdlRepo.class);
-                    if (wsdlRepo != null) {
-                        String wsdlLocation = wsdlRepo.getWsdl(serviceRef.getPortId(), serviceRef.getServiceQName(), referenceClassName);
-                        if (wsdlLocation != null) {
-                            try {
-                                wsdlUrl = new URL(wsdlLocation).toExternalForm();
-                            } catch (MalformedURLException e) {
-                            }
-                        }
+                    if (portAddresses.size() == 1) {
+                        PortAddress portAddress = portAddresses.iterator().next();
+                        serviceMetaData.setWsdlUrl(portAddress.getAddress() + "?wsdl");
                     }
-                    serviceMetaData.setWsdlUrl(wsdlUrl);
 
-                    if (serviceRef.getServiceQName() != null) {
-                        serviceMetaData.setServiceQName(serviceRef.getServiceQName().toString());
-                    }
+                    // add handler chains
                     for (HandlerChainData handlerChain : serviceRef.getHandlerChains()) {
                         HandlerChainMetaData handlerChainMetaData = new HandlerChainMetaData();
                         handlerChainMetaData.setServiceNamePattern(handlerChain.getServiceNamePattern());
@@ -228,14 +233,37 @@
                         }
                         serviceMetaData.getHandlerChains().add(handlerChainMetaData);
                     }
+
+                    // add port refs
+                    Map<QName,PortRefMetaData> portsByQName = new HashMap<QName,PortRefMetaData>();
                     for (PortRefData portRef : serviceRef.getPortRefs()) {
                         PortRefMetaData portRefMetaData = new PortRefMetaData();
-                        portRefMetaData.setPortComponentLink(portRef.getPortComponentLink());
+                        portRefMetaData.setQName(portRef.getQName());
+                        portRefMetaData.setServiceEndpointInterface(portRef.getServiceEndpointInterface());
                         portRefMetaData.setEnableMtom(portRef.isEnableMtom());
-                        portRefMetaData.setServiceEndpointInterface(portRef.getServiceEndpointInterface().getName());
                         portRefMetaData.getProperties().putAll(portRef.getProperties());
+                        portRefMetaData.getAddresses().addAll(portRef.getAddresses());
+                        if (portRef.getQName() != null) {
+                            portsByQName.put(portRef.getQName(), portRefMetaData);
+                        }
                         serviceMetaData.getPortRefs().add(portRefMetaData);
+                    }
 
+                    // add PortRefMetaData for any portAddress not added above
+                    for (PortAddress portAddress : portAddresses) {
+                        PortRefMetaData portRefMetaData = portsByQName.get(portAddress.getQName());
+                        if (portRefMetaData == null) {
+                            portRefMetaData = new PortRefMetaData();
+                            portRefMetaData.setQName(portAddress.getQName());
+                            portRefMetaData.setServiceEndpointInterface(portAddress.getServiceEndpointInterface());
+                            portRefMetaData.getAddresses().add(portAddress.getAddress());
+                            serviceMetaData.getPortRefs().add(portRefMetaData);
+                        } else {
+                            portRefMetaData.getAddresses().add(portAddress.getAddress());
+                            if (portRefMetaData.getServiceEndpointInterface() == null) {
+                                portRefMetaData.setServiceEndpointInterface(portAddress.getServiceEndpointInterface());
+                            }
+                        }
                     }
 
                     res.setResponseCode(ResponseCodes.JNDI_WEBSERVICE);
@@ -252,7 +280,7 @@
             }
 
 
-            BaseEjbProxyHandler handler = null;
+            BaseEjbProxyHandler handler;
             try {
                 handler = (BaseEjbProxyHandler) ProxyManager.getInvocationHandler(object);
             } catch (Exception e) {

Modified: openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java?rev=593641&r1=593640&r2=593641&view=diff
==============================================================================
--- openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java (original)
+++ openejb/trunk/openejb3/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java Fri Nov  9 12:30:50 2007
@@ -32,8 +32,8 @@
 import org.apache.openejb.assembler.classic.WebAppInfo;
 import org.apache.openejb.assembler.classic.ServletInfo;
 import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.core.webservices.WsdlRepoImpl;
-import org.apache.openejb.core.webservices.WsdlRepo;
+import org.apache.openejb.core.webservices.PortAddressRegistryImpl;
+import org.apache.openejb.core.webservices.PortAddressRegistry;
 import org.apache.openejb.core.webservices.PortData;
 import org.apache.openejb.core.CoreContainerSystem;
 import org.apache.openejb.core.WebDeploymentInfo;
@@ -67,7 +67,7 @@
     public static final String WS_ADDRESS_FORMAT = "openejb.wsAddress.format";
     private StringTemplate wsAddressTemplate;
 
-    private WsdlRepo wsdlRepo;
+    private PortAddressRegistry portAddressRegistry;
     private CoreContainerSystem containerSystem;
     private Assembler assembler;
     private WsRegistry wsRegistry;
@@ -149,12 +149,12 @@
 
     public void start() throws ServiceException {
         wsRegistry = SystemInstance.get().getComponent(WsRegistry.class);
-        if (wsdlRepo == null) {
-            wsdlRepo = new WsdlRepoImpl();
-            SystemInstance.get().setComponent(WsdlRepo.class, wsdlRepo);
+        if (portAddressRegistry == null) {
+            portAddressRegistry = new PortAddressRegistryImpl();
+            SystemInstance.get().setComponent(PortAddressRegistry.class, portAddressRegistry);
         }
         containerSystem = (CoreContainerSystem) SystemInstance.get().getComponent(ContainerSystem.class);
-        wsdlRepo = SystemInstance.get().getComponent(WsdlRepo.class);
+        portAddressRegistry = SystemInstance.get().getComponent(PortAddressRegistry.class);
         assembler = SystemInstance.get().getComponent(Assembler.class);
         if (assembler != null) {
             assembler.addDeploymentListener(this);
@@ -239,7 +239,7 @@
                                 String address = selectSingleAddress(addresses);
 
                                 // register wsdl location
-                                wsdlRepo.addWsdl(portInfo.portId, portInfo.wsdlService, portInfo.seiInterfaceName, address.toString());
+                                portAddressRegistry.addPort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId, portInfo.wsdlPort, portInfo.seiInterfaceName, address);
                                 logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Ejb(id=" + portInfo.portId + ")");
                                 ejbAddresses.put(bean.ejbDeploymentId, address);
                             }
@@ -266,7 +266,7 @@
                 }
 
                 for (ServletInfo servlet : webApp.servlets) {
-                    PortInfo portInfo = ports.get(servlet.servletClass);
+                    PortInfo portInfo = ports.get(servlet.servletName);
                     if (portInfo == null) continue;
 
                     try {
@@ -287,7 +287,7 @@
                             String address = selectSingleAddress(addresses);
 
                             // add address to global registry
-                            wsdlRepo.addWsdl(portInfo.portId, portInfo.wsdlService, portInfo.seiInterfaceName, address.toString());
+                            portAddressRegistry.addPort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId, portInfo.wsdlPort, portInfo.seiInterfaceName, address);
                             logger.info("Webservice(wsdl=" + address + ", qname=" + port.getWsdlService() + ") --> Pojo(id=" + portInfo.portId + ")");
                             servletAddresses.put(webApp.moduleId + "." + servlet.servletName, address);
                         }
@@ -317,7 +317,7 @@
                         // remove wsdl addresses from global registry
                         String address = ejbAddresses.remove(enterpriseBean.ejbDeploymentId);
                         if (address != null) {
-                            wsdlRepo.removeWsdl(portInfo.portId, portInfo.wsdlService, portInfo.seiInterfaceName, address);
+                            portAddressRegistry.removePort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId);
                         }
 
                         // remove container from web server
@@ -344,7 +344,7 @@
                     // remove wsdl addresses from global registry
                     String address = servletAddresses.remove(webApp.moduleId + "." + servlet.servletName);
                     if (address != null) {
-                        wsdlRepo.removeWsdl(portInfo.portId, portInfo.wsdlService, portInfo.seiInterfaceName, address);
+                        portAddressRegistry.removePort(portInfo.serviceId, portInfo.wsdlService, portInfo.portId);
                     }
 
                     // clear servlet's reference to the webservice container
@@ -381,7 +381,7 @@
         contextData.put("ejbDeploymentId", bean.ejbDeploymentId);
         contextData.put("ejbType", getEjbType(bean.type));
         contextData.put("ejbClass", bean.ejbClass);
-        contextData.put("ejbClass.simpleName", bean.ejbClass.substring(bean.ejbClass.lastIndexOf('.')));
+        contextData.put("ejbClass.simpleName", bean.ejbClass.substring(bean.ejbClass.lastIndexOf('.') + 1));
         contextData.put("ejbName", bean.ejbName);
         contextData.put("portComponentName", port.getPortName().getLocalPart());
         contextData.put("wsdlPort", port.getWsdlPort().getLocalPart());



Mime
View raw message