[jbossws-commits] JBossWS SVN: r3559 - in branches/jbossws-2.0/jbossws-core: src/main/java/javax/xml/ws and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Jun 13 06:54:09 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-06-13 06:54:09 -0400 (Wed, 13 Jun 2007)
New Revision: 3559

Removed:
   branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceExt.java
Modified:
   branches/jbossws-2.0/jbossws-core/ant-import-tests/build-testsuite.xml
   branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/Service.java
   branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
   branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/StubExt.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleEncryptTestCase.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java
Log:
Remove ServiceExt, because our JAXWS Service cannot be loaded via endorsed
Move security config getter/setter to StubExt



Modified: branches/jbossws-2.0/jbossws-core/ant-import-tests/build-testsuite.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/ant-import-tests/build-testsuite.xml	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/ant-import-tests/build-testsuite.xml	2007-06-13 10:54:09 UTC (rev 3559)
@@ -77,7 +77,7 @@
     <taskdef name="wsconsume" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
        <classpath refid="ws.stack.classpath"/>
        <classpath location="${spi.dir}/output/lib/jbossws-spi.jar"/>
-        
+       <classpath location="${core.dir}/thirdparty/jaxb-api.jar"/>
        <classpath location="${core.dir}/thirdparty/jaxb-xjc.jar"/>
        <classpath location="${core.dir}/thirdparty/jaxb-impl.jar"/>
        <classpath location="${core.dir}/thirdparty/jaxws-rt.jar"/>

Modified: branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/Service.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/Service.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/javax/xml/ws/Service.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -718,23 +718,7 @@
     **/
    public static Service create(URL wsdlLocation, QName serviceName)
    {
-      Service service;
-      try
-      {
-         Class extClass = Class.forName("org.jboss.ws.core.jaxws.client.ServiceExt");
-         Constructor ctor = extClass.getConstructor(new Class[] { URL.class, QName.class });
-         service = (Service)ctor.newInstance(new Object[] { wsdlLocation, serviceName });
-      }
-      catch (InvocationTargetException ex)
-      {
-         Throwable target = ex.getTargetException();
-         throw new WebServiceException(target);
-      }
-      catch (Exception e)
-      {
-         service = new Service(wsdlLocation, serviceName);
-      }
-      return service;
+      return new Service(wsdlLocation, serviceName);
    }
 
    /**

Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -23,6 +23,7 @@
 
 // $Id:CommonClient.java 660 2006-08-01 16:29:43Z thomas.diesler at jboss.com $
 
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -54,6 +55,7 @@
 import org.jboss.ws.core.utils.HolderUtils;
 import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
 import org.jboss.ws.integration.ResourceLoaderAdapter;
+import org.jboss.ws.integration.UnifiedVirtualFile;
 import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
 import org.jboss.ws.metadata.umdm.EndpointMetaData;
 import org.jboss.ws.metadata.umdm.OperationMetaData;
@@ -61,6 +63,8 @@
 import org.jboss.ws.metadata.umdm.ServiceMetaData;
 import org.jboss.ws.metadata.umdm.UnifiedMetaData;
 import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
+import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
+import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
 
 /**
@@ -88,6 +92,8 @@
    private Map<QName, UnboundHeader> unboundHeaders = new LinkedHashMap<QName, UnboundHeader>();
    // A List<AttachmentPart> of attachment parts set through the proxy
    private List<AttachmentPart> attachmentParts = new ArrayList<AttachmentPart>();
+   // The WS-Security config
+   private String securityConfig;
 
    /** Create a call that needs to be configured manually
     */
@@ -639,4 +645,34 @@
       EndpointMetaData epMetaData = getEndpointMetaData();
       return epMetaData.getConfigFile();
    }
+   
+   public String getSecurityConfig()
+   {
+      return securityConfig;
+   }
+
+   public void setSecurityConfig(String securityConfig)
+   {
+      this.securityConfig = securityConfig;
+      
+      if (securityConfig != null)
+      {
+         EndpointMetaData epMetaData = getEndpointMetaData();
+         ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
+         if (serviceMetaData.getSecurityConfiguration() == null)
+         {
+            try
+            {
+               WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance();
+               UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile();
+               WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig);
+               serviceMetaData.setSecurityConfiguration(config);
+            }
+            catch (IOException ex)
+            {
+               WSException.rethrow("Cannot set security config", ex);
+            }
+         }
+      }
+   }
 }

Modified: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/StubExt.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/StubExt.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/StubExt.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -126,4 +126,14 @@
     * Creates a new empty AttachmentPart object.
     */
    AttachmentPart createAttachmentPart();
+
+   /** 
+    * Get the WS-Security configuration  
+    */
+   String getSecurityConfig();
+
+   /** 
+    * Set the WS-Security configuration  
+    */
+   void setSecurityConfig(String securityConfig);
 }

Deleted: branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceExt.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceExt.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/ServiceExt.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -1,178 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.core.jaxws.client;
-
-// $Id$
-
-import java.io.IOException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.EndpointReference;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebServiceFeature;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.ConfigProvider;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.integration.UnifiedVirtualFile;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.wsse.WSSecurityConfigFactory;
-import org.jboss.ws.metadata.wsse.WSSecurityConfiguration;
-
-/**
- * Extends the standard JAXWS Service 
- *
- * @author Thomas.Diesler at jboss.com
- * @since 18-Jan-2007
- */
-public class ServiceExt extends Service implements ConfigProvider
-{
-   // The config name for all created ports 
-   private String configName;
-   // The config file for all created ports 
-   private String configFile;
-   // The WS-Security config
-   private String securityConfig;
-
-   public ServiceExt(URL wsdlDocumentLocation, QName serviceName)
-   {
-      super(wsdlDocumentLocation, serviceName);
-   }
-
-   /** 
-    * Get the port configuration file for newly created ports 
-    */
-   public String getConfigFile()
-   {
-      return configFile;
-   }
-
-   /** 
-    * Get the port configuration name for newly created ports 
-    */
-   public String getConfigName()
-   {
-      return configName;
-   }
-
-   /** 
-    * Set the port configuration name for newly created ports 
-    */
-   public void setConfigName(String configName)
-   {
-      this.configName = configName;
-   }
-
-   /** 
-    * Set the port configuration name for newly created ports 
-    */
-   public void setConfigName(String configName, String configFile)
-   {
-      this.configName = configName;
-      this.configFile = configFile;
-   }
-
-   /** 
-    * Get the WS-Security configuration  
-    */
-   public String getSecurityConfig()
-   {
-      return securityConfig;
-   }
-
-   /** 
-    * Set the WS-Security configuration  
-    */
-   public void setSecurityConfig(String securityConfig)
-   {
-      this.securityConfig = securityConfig;
-   }
-
-   @Override
-   public <T> T getPort(Class<T> serviceEndpointInterface, WebServiceFeature... features)
-   {
-      T port = super.getPort(serviceEndpointInterface, features);
-      configurePort(port);
-      return port;
-   }
-
-   @Override
-   public <T> T getPort(Class<T> serviceEndpointInterface)
-   {
-      T port = super.getPort(serviceEndpointInterface);
-      configurePort(port);
-      return port;
-   }
-
-   @Override
-   public <T> T getPort(EndpointReference endpointReference, Class<T> serviceEndpointInterface, WebServiceFeature... features)
-   {
-      T port = super.getPort(endpointReference, serviceEndpointInterface, features);
-      configurePort(port);
-      return port;
-   }
-
-   @Override
-   public <T> T getPort(QName portName, Class<T> serviceEndpointInterface, WebServiceFeature... features)
-   {
-      T port = super.getPort(portName, serviceEndpointInterface, features);
-      configurePort(port);
-      return port;
-   }
-
-   @Override
-   public <T> T getPort(QName portName, Class<T> serviceEndpointInterface)
-   {
-      T port = super.getPort(portName, serviceEndpointInterface);
-      configurePort(port);
-      return port;
-   }
-
-   private void configurePort(Object port)
-   {
-      ConfigProvider cp = (ConfigProvider)port;
-      if (configName != null || configFile != null)
-         cp.setConfigName(configName, configFile);
-
-      if (securityConfig != null)
-      {
-         EndpointMetaData epMetaData = ((StubExt)port).getEndpointMetaData();
-         ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
-         if (serviceMetaData.getSecurityConfiguration() == null)
-         {
-            try
-            {
-               WSSecurityConfigFactory wsseConfFactory = WSSecurityConfigFactory.newInstance();
-               UnifiedVirtualFile vfsRoot = serviceMetaData.getUnifiedMetaData().getRootFile();
-               WSSecurityConfiguration config = wsseConfFactory.createConfiguration(vfsRoot, securityConfig);
-               serviceMetaData.setSecurityConfiguration(config);
-            }
-            catch (IOException ex)
-            {
-               WSException.rethrow("Cannot set security config", ex);
-            }
-         }
-      }
-   }
-}

Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleEncryptTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleEncryptTestCase.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleEncryptTestCase.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -32,7 +32,6 @@
 import junit.framework.Test;
 
 import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.jaxws.client.ServiceExt;
 import org.jboss.wsf.spi.test.JBossWSTest;
 import org.jboss.wsf.spi.test.JBossWSTestSetup;
 
@@ -73,9 +72,9 @@
       QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");
 
       Service service = Service.create(wsdlURL, serviceName);
-      ((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
       
       Hello port = (Hello)service.getPort(Hello.class);
+      ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
       ((StubExt)port).setConfigName("Standard WSSecurity Client");
 
       Map<String, Object> reqContext = ((BindingProvider)port).getRequestContext();

Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecurity/SimpleSignTestCase.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -32,7 +32,6 @@
 import junit.framework.Test;
 
 import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.jaxws.client.ServiceExt;
 import org.jboss.wsf.spi.test.JBossWSTest;
 import org.jboss.wsf.spi.test.JBossWSTestSetup;
 
@@ -69,9 +68,9 @@
       QName serviceName = new QName("http://org.jboss.ws/samples/wssecurity", "HelloService");
 
       Service service = Service.create(wsdlURL, serviceName);
-      ((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
       
       Hello port = (Hello)service.getPort(Hello.class);
+      ((StubExt)port).setSecurityConfig(securityURL.toExternalForm());
       ((StubExt)port).setConfigName("Standard WSSecurity Client");
 
       Map<String, Object> reqContext = ((BindingProvider)port).getRequestContext();

Modified: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java	2007-06-13 08:04:57 UTC (rev 3558)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wssecuritypolicy/SimpleEncryptTestCase.java	2007-06-13 10:54:09 UTC (rev 3559)
@@ -31,8 +31,6 @@
 
 import junit.framework.Test;
 
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.core.jaxws.client.ServiceExt;
 import org.jboss.wsf.spi.test.JBossWSTest;
 import org.jboss.wsf.spi.test.JBossWSTestSetup;
 




More information about the jbossws-commits mailing list