[jbossws-commits] JBossWS SVN: r4724 - in stack/native/trunk: src/main/java/org/jboss/ws/core/binding and 9 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Oct 10 10:19:14 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-10-10 10:19:14 -0400 (Wed, 10 Oct 2007)
New Revision: 4724

Added:
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocRequest.java
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocResponse.java
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/Endpoint.java
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/EndpointImpl.java
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/JBWS1809TestCase.java
   stack/native/trunk/src/test/resources/jaxws/jbws1809/
   stack/native/trunk/src/test/resources/jaxws/jbws1809/META-INF/
   stack/native/trunk/src/test/resources/jaxws/jbws1809/META-INF/jaxb-intros.xml
Modified:
   stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
   stack/native/trunk/ant-import-tests/build-testsuite.xml
   stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
   stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
   stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
   stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
   stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
   stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
   stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
   stack/native/trunk/src/main/resources/jbossws-native-config.xml
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
Log:
JBWS-1809: JAXBIntros are not taken into consideration when generating the WSDL

Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml	2007-10-10 14:19:14 UTC (rev 4724)
@@ -413,6 +413,16 @@
       </fileset>
     </jar>
     
+    <!-- jaxws-jbws1809 -->
+    <jar destfile="${tests.output.dir}/libs/jaxws-jbws1809.jar">
+      <fileset dir="${tests.output.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/jbws1809/*.class"/>
+        <exclude name="org/jboss/test/ws/jaxws/jbws1809/*TestCase.class"/>
+      </fileset>
+      <metainf dir="${tests.output.dir}/resources/jaxws/jbws1809/META-INF"/>
+    </jar>
+
+
     <!-- jaxws namespace -->
     <war warfile="${tests.output.dir}/libs/jaxws-namespace.war" webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
       <classes dir="${tests.output.dir}/classes">

Modified: stack/native/trunk/ant-import-tests/build-testsuite.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-testsuite.xml	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/ant-import-tests/build-testsuite.xml	2007-10-10 14:19:14 UTC (rev 4724)
@@ -179,7 +179,7 @@
 			<classpath location="${tests.output.dir}/resources/jaxws/samples/wssecurityAnnotatedpolicy"/>
 		</taskdef>
 
-		<wsprovide resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurity" genwsdl="true" sei="org.jboss.test.ws.jaxws.samples.wssecurity.HelloJavaBean"/>
+		<wsprovide resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurity" genwsdl="true" sei="org.jboss.test.ws.jaxws.samples.wssecurity.HelloJavaBean" verbose="true"/>
 		<wsprovide resourcedestdir="${tests.output.dir}/wsprovide/resources/jaxws/samples/wssecurityAnnotatedpolicy" genwsdl="true" sei="org.jboss.test.ws.jaxws.samples.wssecurityAnnotatedpolicy.HelloJavaBean"/>
 	</target>
 

Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeDeserializer.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -21,8 +21,11 @@
  */
 package org.jboss.ws.core.binding;
 
+import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.core.soap.MessageContextAssociation;
 
-
 // $Id$
 
 /**
@@ -34,4 +37,14 @@
 public abstract class ComplexTypeDeserializer extends DeserializerSupport
 {
 
+   protected BindingCustomization getBindingCustomization()
+   {
+      BindingCustomization bindingCustomization = null;
+      EndpointMetaData epMetaData = MessageContextAssociation.peekMessageContext().getEndpointMetaData();
+      if(epMetaData instanceof ServerEndpointMetaData)
+      {
+         bindingCustomization = ((ServerEndpointMetaData)epMetaData).getEndpoint().getAttachment(BindingCustomization.class);
+      }
+      return bindingCustomization;
+   }
 }

Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/binding/ComplexTypeSerializer.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -21,9 +21,11 @@
  */
 package org.jboss.ws.core.binding;
 
+import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
+import org.jboss.ws.core.soap.MessageContextAssociation;
 
-
-
 // $Id: ComplexTypeSerializer.java 1757 2006-12-22 15:40:24Z thomas.diesler at jboss.com $
 
 /**
@@ -34,5 +36,14 @@
  */
 public abstract class ComplexTypeSerializer extends SerializerSupport
 {
-
+   protected BindingCustomization getBindingCustomization()
+   {
+      BindingCustomization bindingCustomization = null;
+      EndpointMetaData epMetaData = MessageContextAssociation.peekMessageContext().getEndpointMetaData();
+      if(epMetaData instanceof ServerEndpointMetaData)
+      {
+         bindingCustomization = ((ServerEndpointMetaData)epMetaData).getEndpoint().getAttachment(BindingCustomization.class);
+      }
+      return bindingCustomization;
+   }
 }

Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/CustomizableJAXBContextFactory.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -21,18 +21,22 @@
  */
 package org.jboss.ws.core.jaxws;
 
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.bind.v2.model.annotation.RuntimeAnnotationReader;
+import org.jboss.logging.Logger;
 import org.jboss.ws.WSException;
-import org.jboss.ws.core.CommonMessageContext;
-import org.jboss.ws.core.soap.MessageContextAssociation;
 import org.jboss.wsf.spi.binding.BindingCustomization;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
-import java.util.Iterator;
+import java.util.Collection;
 
 /**
  * The default factory checks if a {@link JAXBBindingCustomization} exists
  * and uses it to customize the JAXBContext that will be created.
+ * <p>
+ * It uses the {@link org.jboss.wsf.spi.invocation.EndpointAssociation} to access customizations.
  *
  * @see org.jboss.wsf.spi.deployment.Endpoint
  * @see org.jboss.wsf.spi.binding.BindingCustomization
@@ -46,45 +50,54 @@
  */
 public class CustomizableJAXBContextFactory extends JAXBContextFactory
 {
+   protected Logger log = Logger.getLogger(CustomizableJAXBContextFactory.class);
+
+   public JAXBContext createContext(Class clazz) throws WSException
+   {
+      return createContext(new Class[] {clazz});
+   }
+   
    public JAXBContext createContext(Class[] clazzes) throws WSException
    {
       try
       {
-         BindingCustomization customization = getCustomization();
-         if(null == customization)
-            return JAXBContext.newInstance(clazzes);
-         else
-            return JAXBContext.newInstance(clazzes, customization);
+         return JAXBContext.newInstance(clazzes);
       }
       catch (JAXBException e) {
          throw new WSException("Failed to create JAXBContext", e);
       }
    }
 
-   public JAXBContext createContext(Class clazz) throws WSException
+   public JAXBContext createContext(Class[] clazzes, BindingCustomization bindingCustomization) throws WSException
    {
-      return createContext(new Class[] {clazz});
+      try
+      {        
+         return JAXBContext.newInstance(clazzes, bindingCustomization);
+      }
+      catch (JAXBException e) {
+         throw new WSException("Failed to create JAXBContext", e);
+      }
    }
 
-   private BindingCustomization getCustomization()
+   public JAXBRIContext createContext(
+     Class[] classes, Collection<TypeReference> typeReferences,
+     String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization bindingCustomization)
    {
-      BindingCustomization customization = null;
+      try
+      {         
+         RuntimeAnnotationReader runtimeAnnotations = bindingCustomization!=null ?
+           (RuntimeAnnotationReader)bindingCustomization.get(JAXBRIContext.ANNOTATION_READER) : null;
 
-      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
-      if(msgContext!=null) // may not be available anytime
-      {
-         Iterator<BindingCustomization> it = msgContext.getEndpointMetaData().getBindingCustomizations().iterator();
-         while(it.hasNext())
-         {
-            BindingCustomization current = it.next();
-            if(current instanceof JAXBBindingCustomization)
-            {
-               customization = current;
-               break;
-            }
-         }
+         return JAXBRIContext.newInstance(
+           classes, typeReferences,
+           null,
+           defaultNamespaceRemap, c14nSupport ,
+           runtimeAnnotations
+         );
+
       }
-
-      return customization;
+      catch (JAXBException e) {
+         throw new WSException("Failed to create JAXBContext", e);
+      }
    }
 }

Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBContextFactory.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -23,9 +23,15 @@
 
 import org.jboss.ws.WSException;
 import org.jboss.wsf.spi.util.ServiceLoader;
+import org.jboss.wsf.spi.binding.BindingCustomization;
 
 import javax.xml.bind.JAXBContext;
 
+import com.sun.xml.bind.api.TypeReference;
+import com.sun.xml.bind.api.JAXBRIContext;
+
+import java.util.Collection;
+
 /**
  * Creates JAXBContext's.<p>
  *
@@ -36,10 +42,16 @@
 
    public final static String DEFAULT_JAXB_CONTEXT_FACTORY = "org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory";
 
+   public abstract JAXBContext createContext(Class[] clazzes, BindingCustomization bindingCustomization) throws WSException;
+
    public abstract JAXBContext createContext(Class[] clazzes) throws WSException;
 
    public abstract JAXBContext createContext(Class clazz) throws WSException;
 
+   public abstract JAXBRIContext createContext(
+     Class[] classes, Collection<TypeReference> typeReferences,
+     String defaultNamespaceRemap, boolean c14nSupport, BindingCustomization bindingCustomization);
+
    /**
     * Retrieve JAXBContextFactory instance through the {@link org.jboss.wsf.spi.util.ServiceLoader}.
     * Defaults to {@link CustomizableJAXBContextFactory}

Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBDeserializer.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -28,7 +28,12 @@
 import org.jboss.ws.core.binding.TypeMappingImpl;
 import org.jboss.ws.core.binding.ComplexTypeDeserializer;
 import org.jboss.ws.core.binding.SerializationContext;
+import org.jboss.ws.core.soap.MessageContextAssociation;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
 import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.binding.BindingCustomization;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
@@ -88,11 +93,13 @@
     * @return JAXBContext
     */
    private JAXBContext getJAXBContext(Class[] types){
+
       JAXBContextCache cache = JAXBContextCache.getContextCache();
       JAXBContext context = cache.get(types);
       if(null==context)
       {
-         context = JAXBContextFactory.newInstance().createContext(types);
+         BindingCustomization bindingCustomization = getBindingCustomization();
+         context = JAXBContextFactory.newInstance().createContext(types, bindingCustomization);
          cache.add(types, context);
       }
       return context;

Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/JAXBSerializer.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -29,6 +29,7 @@
 import org.jboss.ws.core.binding.ComplexTypeSerializer;
 import org.jboss.ws.core.binding.SerializationContext;
 import org.jboss.ws.core.binding.BufferedStreamResult;
+import org.jboss.wsf.spi.binding.BindingCustomization;
 import org.w3c.dom.NamedNodeMap;
 
 import javax.xml.bind.JAXBContext;
@@ -99,7 +100,8 @@
       JAXBContext context = cache.get(types);
       if(null==context)
       {
-         context = JAXBContextFactory.newInstance().createContext(types);
+         BindingCustomization bindingCustomization = getBindingCustomization();
+         context = JAXBContextFactory.newInstance().createContext(types, bindingCustomization);
          cache.add(types, context);
       }
       return context;

Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -23,42 +23,13 @@
 
 // $Id$
 
-import java.io.File;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.HandlerChain;
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.soap.SOAPBinding;
-import javax.jws.soap.SOAPMessageHandlers;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.BindingType;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-import javax.xml.ws.WebFault;
-import javax.xml.ws.addressing.Action;
-import javax.xml.ws.addressing.AddressingProperties;
-
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
 import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
 import org.jboss.ws.WSException;
 import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
+import org.jboss.ws.core.jaxws.JAXBContextFactory;
 import org.jboss.ws.core.jaxws.WrapperGenerator;
 import org.jboss.ws.core.soap.Style;
 import org.jboss.ws.core.soap.Use;
@@ -75,6 +46,7 @@
 import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS;
 import org.jboss.ws.metadata.umdm.OperationMetaData;
 import org.jboss.ws.metadata.umdm.ParameterMetaData;
+import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
 import org.jboss.ws.metadata.umdm.TypeMappingMetaData;
 import org.jboss.ws.metadata.umdm.TypesMetaData;
 import org.jboss.ws.metadata.umdm.WrappedParameter;
@@ -83,18 +55,47 @@
 import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
 import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
 import org.jboss.ws.metadata.wsdl.WSDLMIMEPart;
+import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.spi.binding.BindingCustomization;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.HandlerChainsObjectFactory;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
 import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerMetaData.HandlerType;
-import org.jboss.wsf.common.JavaUtils;
+import org.jboss.wsf.spi.deployment.Endpoint;
 import org.jboss.xb.binding.ObjectModelFactory;
 import org.jboss.xb.binding.Unmarshaller;
 import org.jboss.xb.binding.UnmarshallerFactory;
 
-import com.sun.xml.bind.api.JAXBRIContext;
-import com.sun.xml.bind.api.TypeReference;
+import javax.jws.HandlerChain;
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.jws.soap.SOAPMessageHandlers;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.ParameterMode;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+import javax.xml.ws.WebFault;
+import javax.xml.ws.addressing.Action;
+import javax.xml.ws.addressing.AddressingProperties;
+import java.io.File;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Abstract class that represents a JAX-WS metadata builder.
@@ -940,9 +941,27 @@
          String targetNS = epMetaData.getPortTypeName().getNamespaceURI().intern();
          if (log.isDebugEnabled())
             log.debug("JAXBContext [types=" + javaTypes + ",tns=" + targetNS + "]");
-         jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs, targetNS, false);
+
+         JAXBContextFactory factory = JAXBContextFactory.newInstance();
+
+
+         // JAXBIntros may mofiy the WSDL being generated
+         // only true for server side invocation, tooling (WSProvide) doesnt support this
+         BindingCustomization bindingCustomization = null;
+         if(epMetaData instanceof ServerEndpointMetaData)
+         {
+            Endpoint endpoint = ((ServerEndpointMetaData)epMetaData).getEndpoint();
+            bindingCustomization = endpoint!=null ? endpoint.getAttachment(BindingCustomization.class) : null;
+         }
+
+         jaxbCtx = factory.createContext(
+           javaTypes.toArray(new Class[0]),
+           typeRefs,
+           targetNS,
+           false, bindingCustomization
+         );
       }
-      catch (JAXBException ex)
+      catch (WSException ex)
       {
          throw new IllegalStateException("Cannot build JAXB context", ex);
       }

Modified: stack/native/trunk/src/main/resources/jbossws-native-config.xml
===================================================================
--- stack/native/trunk/src/main/resources/jbossws-native-config.xml	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/main/resources/jbossws-native-config.xml	2007-10-10 14:19:14 UTC (rev 4724)
@@ -61,7 +61,7 @@
   </bean>
   
   <bean name="WSNativePublishContractDeploymentAspect" class="org.jboss.wsf.stack.jbws.PublishContractDeploymentAspect">
-    <property name="requires">UnifiedMetaDataModel</property>
+    <property name="requires">UnifiedMetaDataModel, JAXBIntros</property>
     <property name="provides">PublishedContract</property>
   </bean>
   
@@ -70,12 +70,12 @@
   </bean>
   
   <bean name="WSNativeUnifiedMetaDataDeploymentAspect" class="org.jboss.wsf.stack.jbws.UnifiedMetaDataDeploymentAspect">
-    <property name="requires">RuntimeLoader, ContainerMetaData, URLPattern, VFSRoot</property>
+    <property name="requires">RuntimeLoader, ContainerMetaData, URLPattern, VFSRoot, JAXBIntros</property>
     <property name="provides">UnifiedMetaDataModel</property>
   </bean>
 
-  <bean name="WSJAXBIntroDeploymentAspect" class="org.jboss.wsf.stack.jbws.JAXBIntroDeploymentAspect">
-    <property name="requires">UnifiedMetaDataModel, RuntimeLoader</property>
+  <bean name="WSJAXBIntroDeploymentAspect" class="org.jboss.wsf.stack.jbws.JAXBIntroDeploymentAspect">    
+    <property name="provides">JAXBIntros</property>
   </bean>
 
       <!-- Deployment aspect installers -->

Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java	2007-10-10 14:11:21 UTC (rev 4723)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jaxbintros/JAXBIntroTestCase.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -55,7 +55,7 @@
    {
       return new JBossWSTestSetup(JAXBIntroTestCase.class, "jaxws-jaxbintros.war");
    }
-
+                                     
    public void testWSDLAccess() throws Exception
    {
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jaxbintros/ProviderEndpoint?wsdl");

Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocRequest.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocRequest.java	                        (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocRequest.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -0,0 +1,41 @@
+/*
+ * 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.test.ws.jaxws.jbws1809;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+public class DocRequest
+{
+   String value;
+
+   public String getValue()
+   {
+      return value;
+   }
+
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+}


Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocRequest.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocResponse.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocResponse.java	                        (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocResponse.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -0,0 +1,42 @@
+/*
+ * 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.test.ws.jaxws.jbws1809;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+public class DocResponse
+{
+   String value;
+
+
+   public String getValue()
+   {
+      return value;
+   }
+
+   public void setValue(String value)
+   {
+      this.value = value;
+   }
+}


Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/DocResponse.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/Endpoint.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/Endpoint.java	                        (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/Endpoint.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.ws.jaxws.jbws1809;
+
+import javax.ejb.Remote;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+ at Remote
+ at WebService(targetNamespace = "http://org.jboss.ws/jaxbintro/wsdl")
+ at SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface Endpoint
+{
+   DocResponse processDocument(DocRequest req);
+}


Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/Endpoint.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/EndpointImpl.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/EndpointImpl.java	                        (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/EndpointImpl.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.ws.jaxws.jbws1809;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+ at Stateless
+ at WebService(
+  targetNamespace = "http://org.jboss.ws/jaxbintro/wsdl",
+  endpointInterface = "org.jboss.test.ws.jaxws.jbws1809.Endpoint"
+)
+ at SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public class EndpointImpl implements Endpoint
+{
+   public DocResponse processDocument(DocRequest req)
+   {
+      DocResponse res = new DocResponse();
+      res.setValue(req.getValue()+"Response");
+      return res;  
+   }
+}


Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/JBWS1809TestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/JBWS1809TestCase.java	                        (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/JBWS1809TestCase.java	2007-10-10 14:19:14 UTC (rev 4724)
@@ -0,0 +1,92 @@
+/*
+ * 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.test.ws.jaxws.jbws1809;
+
+import junit.framework.Test;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLTypes;
+import org.jboss.ws.metadata.wsdl.DOMTypes;
+import org.jboss.ws.metadata.wsdl.XSModelTypes;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.Iterator;
+
+/**
+ * Test the JAXBIntroduction features.
+ *
+ * Check if the WSDL is generated correctly.
+ * The introduction should turn a property into a xsd:attribute declaration.
+ *
+ * @author heiko.braun at jboss.com
+ */
+public class JBWS1809TestCase extends JBossWSTest
+{
+   public static Test suite()
+   {
+      return new JBossWSTestSetup(JBWS1809TestCase.class, "jaxws-jbws1809.jar");
+   }
+
+   public void testWSDLAccess() throws Exception
+   {
+      URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1809/EndpointImpl?wsdl");
+      WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+      WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+      assertNotNull("Unable to read WSDL definitions", wsdlDefinitions);
+
+      XSModelTypes wsdlTypes = (XSModelTypes)wsdlDefinitions.getWsdlTypes();
+
+      // convert XSModelTypes to dom representation
+      // it's easier to consume...
+
+      Element types = DOMUtils.parse(wsdlTypes.getSchemaModel().serialize());            
+      Iterator it = DOMUtils.getChildElements(types, "complexType");
+
+      boolean foundAttributeDeclaration = false;
+      while(it.hasNext())
+      {
+         Element next = (Element)it.next();
+         if(DOMUtils.getAttributeValue(next, "name").equals("docRequest"))
+         {
+            Iterator it2 = DOMUtils.getChildElements(next, "attribute");
+
+            while(it2.hasNext())
+            {
+               Element next2 = (Element)it2.next();
+               if(DOMUtils.getAttributeValue(next2, "name").equals("value"))
+               {
+                  foundAttributeDeclaration = true;
+               }
+            }
+         }
+      }
+
+      assertTrue("JAXBIntros should turn the 'docRequest.name' property into a XML attribute", foundAttributeDeclaration);
+
+   }
+}


Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1809/JBWS1809TestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/test/resources/jaxws/jbws1809/META-INF/jaxb-intros.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1809/META-INF/jaxb-intros.xml	                        (rev 0)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1809/META-INF/jaxb-intros.xml	2007-10-10 14:19:14 UTC (rev 4724)
@@ -0,0 +1,26 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jaxb-intros xmlns="http://www.jboss.org/xsd/jaxb/intros" default-namespace="http://org.jboss.ws/jaxbintro/wsdl">
+
+  <!--
+  The XSD for the schema can be found at:
+  http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/extras/jaxbintros/src/main/resources/jaxb-intros.xsd
+  Register it against the http://www.jboss.org/xsd/jaxb/intros namespace in your IDE and away you go :-)
+  -->
+
+  <!--
+  Note: how the "name" attributes on class, field and method configs can be regular expressions.
+  -->
+
+  <!--
+  The type namespaces on the customerOrder are different from the rest of the message...
+  -->
+  <Class name="org.jboss.test.ws.jaxws.jbws1809.DocRequest">
+    <XmlAccessorType value="FIELD"/>   
+    <XmlRootElement name="request" namespace="http://org.jboss.ws/jaxbintro/wsdl"/>
+
+    <Field name="value">
+      <XmlAttribute />
+    </Field>    
+  </Class>
+
+</jaxb-intros>


Property changes on: stack/native/trunk/src/test/resources/jaxws/jbws1809/META-INF/jaxb-intros.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbossws-commits mailing list