cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r609869 - in /incubator/cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/databinding/jaxb/src/main...
Date Tue, 08 Jan 2008 04:39:52 GMT
Author: ema
Date: Mon Jan  7 20:39:51 2008
New Revision: 609869

URL: http://svn.apache.org/viewvc?rev=609869&view=rev
Log:
[CXF-1348,CXF-1349]Support marshal and unmarshal xml list type in RPCInInterceptor and RPCOutInterceptor

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/Server.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTestImpl.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/string_array_test.wsdl
Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java Mon Jan  7 20:39:51 2008
@@ -61,7 +61,6 @@
     private BindingOperationInfo getOperation(Message message, QName opName) {
         return ServiceModelUtil.getOperation(message.getExchange(), opName);
     }
-
     public void handleMessage(Message message) {
         if (isGET(message)) {
             LOG.info("RPCInInterceptor skipped in HTTP GET method");
@@ -119,10 +118,12 @@
                 // will always generate WSI-BP compliant messages so it's unknown if
                 // the non-WSI-BP toolkits will be able to understand the CXF
                 // generated messages if they are expecting it to be qualified.
+                Iterator<MessagePartInfo> partItr = msg.getMessageParts().iterator();
                 while (!qn.getLocalPart().equals(part.getConcreteName().getLocalPart())
-                    && itr.hasNext()) {
-                    part = itr.next();
+                    && partItr.hasNext()) {
+                    part = partItr.next();
                 }
+                
                 if (!qn.equals(part.getConcreteName())) {
                     throw new Fault(
                                     new org.apache.cxf.common.i18n.Message(
@@ -130,6 +131,8 @@
                                                                            LOG,
                                                                            qn));
                 }
+                //honor JAXBAnnotation
+                part.setProperty("honor.jaxb.annotations", true);
                 parameters.put(part, dr.read(part, xmlReader));
             }
         }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java Mon Jan  7 20:39:51 2008
@@ -18,7 +18,6 @@
  */
 
 package org.apache.cxf.binding.soap.interceptor;
-
 import java.util.List;
 import java.util.logging.Logger;
 
@@ -81,6 +80,10 @@
                             new org.apache.cxf.common.i18n.Message("BP_2211_RPCLIT_CANNOT_BE_NULL",
                                                                    LOG, part.getConcreteName()));
                     }
+                   //WSI-BP R2737  -RPC/LIG part name space is empty
+                   // part.setConcreteName(new QName("", part.getConcreteName().getLocalPart()));
+                    part.setProperty("honor.jaxb.annotations", true);
+                    
                 }
             }
             writeParts(message, message.getExchange(), operation, objs, parts);
@@ -106,5 +109,4 @@
     protected XMLStreamWriter getXMLStreamWriter(Message message) {
         return message.getContent(XMLStreamWriter.class);
     }
-
 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractOutDatabindingInterceptor.java Mon Jan  7 20:39:51 2008
@@ -58,6 +58,8 @@
         return Boolean.TRUE.equals(message.containsKey(Message.REQUESTOR_ROLE));
     }
     
+
+       
     protected void writeParts(Message message, Exchange exchange, 
                               BindingOperationInfo operation, MessageContentsList objs, 
                               List<MessagePartInfo> parts) {
@@ -81,7 +83,7 @@
             for (MessagePartInfo part : parts) {
                 if (objs.hasValue(part)) {
                     Object o = objs.get(part);
-                    osWriter.write(o, part, out);
+                    osWriter.write(o, part, out);                  
                 }
             }
         } else {
@@ -95,6 +97,9 @@
             }
         }
     }
+    
+    
+    
     
     protected boolean writeToOutputStream(Message m, BindingInfo info, Service s) {
         /**

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBase.java Mon Jan  7 20:39:51 2008
@@ -19,9 +19,14 @@
 
 package org.apache.cxf.jaxb;
 
+import java.lang.annotation.Annotation;
 import java.util.Collection;
+import java.util.List;
 
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.annotation.XmlAttachmentRef;
+import javax.xml.bind.annotation.XmlList;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import javax.xml.bind.attachment.AttachmentMarshaller;
 import javax.xml.bind.attachment.AttachmentUnmarshaller;
 import javax.xml.validation.Schema;
@@ -29,6 +34,8 @@
 import org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller;
 import org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller;
 import org.apache.cxf.message.Attachment;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
 
 /**
  * 
@@ -40,6 +47,7 @@
     protected Collection<Attachment> attachments;
     protected boolean attachmentProcessingEnabled;
     protected boolean unwrapJAXBElement = true;
+ 
     
     protected JAXBDataBase(JAXBContext ctx) {
         context = ctx;
@@ -81,4 +89,36 @@
             unwrapJAXBElement = Boolean.TRUE.equals(value);
         }
     }
+    
+    protected Annotation[] getJAXBAnnotion(MessagePartInfo mpi) {
+        List<Annotation> annoList = new java.util.concurrent.CopyOnWriteArrayList<Annotation>();
+        
+        if (mpi != null && mpi.getProperty("parameter.annotations") != null) {
+            Annotation[] anns = (Annotation[])mpi.getProperty("parameter.annotations");
+            for (Annotation ann : anns) {
+                if (ann instanceof XmlList || ann instanceof XmlAttachmentRef
+                    || ann instanceof XmlJavaTypeAdapter) {
+                    annoList.add(ann);
+                }
+            }
+        }
+        if (annoList.size() == 0 && mpi != null 
+            && mpi.getMessageInfo() != null
+            && mpi.getMessageInfo().getOperation() != null
+            && mpi.getMessageInfo().getOperation().getProperty("method.return.annotations") != null) {
+            OperationInfo op = mpi.getMessageInfo().getOperation();
+            Annotation[] anns = (Annotation[])op.getProperty("method.return.annotations");
+            for (Annotation ann : anns) {
+                if (ann instanceof XmlList || ann instanceof XmlAttachmentRef
+                    || ann instanceof XmlJavaTypeAdapter) {
+                    annoList.add(ann);
+                }
+            }
+            
+        }
+        return annoList.toArray(new Annotation[]{});       
+    }
+    
+    
+    
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java Mon Jan  7 20:39:51 2008
@@ -77,6 +77,8 @@
     public static final String SCHEMA_RESOURCE = "SCHEMRESOURCE";
     
     public static final String UNWRAP_JAXB_ELEMENT = "unwrap.jaxb.element";
+    
+    public static final String USE_JAXB_BRIDGE = "use.jaxb.bridge";
 
     private static final Logger LOG = LogUtils.getLogger(JAXBDataBinding.class);
 

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Mon Jan  7 20:39:51 2008
@@ -19,7 +19,7 @@
 
 package org.apache.cxf.jaxb;
 
-
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.reflect.Array;
 import java.lang.reflect.Constructor;
@@ -35,9 +35,11 @@
 import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
@@ -56,11 +58,15 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
 import javax.xml.validation.Schema;
-
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import com.sun.xml.bind.api.Bridge;
+import com.sun.xml.bind.api.JAXBRIContext;
+import com.sun.xml.bind.api.TypeReference;
+
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -79,13 +85,14 @@
 public final class JAXBEncoderDecoder {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JAXBEncoderDecoder.class);
     private static final Logger LOG = LogUtils.getLogger(JAXBEncoderDecoder.class);
-    
+
     private JAXBEncoderDecoder() {
     }
 
-    private static Marshaller createMarshaller(JAXBContext context, Class<?> cls,
-                                               Map<String, Object> marshallerProperties)
-        throws JAXBException {
+    private static Marshaller createMarshaller(JAXBContext context, 
+                                               Class<?> cls,
+                                               Map<String, Object> marshallerProperties) throws 
+                                               JAXBException {
         Marshaller jm = null;
         if (context == null) {
             context = JAXBContext.newInstance(cls);
@@ -108,27 +115,23 @@
     }
 
     @SuppressWarnings("unchecked")
-    public static void marshall(JAXBContext context, 
-                                Schema schema, 
-                                Object elValue, 
-                                MessagePartInfo part,
-                                Object source, 
-                                AttachmentMarshaller am,
+    public static void marshall(JAXBContext context, Schema schema, Object elValue, MessagePartInfo part,
+                                Object source, AttachmentMarshaller am,
                                 Map<String, Object> marshallerProperties) {
         Class<?> cls = null;
         if (part != null) {
             cls = part.getTypeClass();
-        } 
+        }
 
         if (cls == null) {
             cls = null != elValue ? elValue.getClass() : null;
         }
-        
+
         if (cls != null && cls.isArray() && elValue instanceof Collection) {
-            Collection<?> col = (Collection<?>) elValue;
-            elValue = col.toArray((Object[]) Array.newInstance(cls.getComponentType(), col.size()));
+            Collection<?> col = (Collection<?>)elValue;
+            elValue = col.toArray((Object[])Array.newInstance(cls.getComponentType(), col.size()));
         }
-        
+
         try {
             Marshaller u = createMarshaller(context, cls, marshallerProperties);
             try {
@@ -150,22 +153,22 @@
             }
 
             if (null != elName) {
-                
-                if (part != null
-                    && part.getXmlSchema() instanceof XmlSchemaElement) {
-                
+
+                if (part != null && part.getXmlSchema() instanceof XmlSchemaElement) {
+
                     XmlSchemaElement el = (XmlSchemaElement)part.getXmlSchema();
-                    
+
                     if (mObj.getClass().isArray()
                         && el.getSchemaType() instanceof XmlSchemaSimpleType
-                        && ((XmlSchemaSimpleType)el.getSchemaType()).getContent()
-                                instanceof XmlSchemaSimpleTypeList) {
+                        && ((XmlSchemaSimpleType)el.getSchemaType()).
+                        getContent() instanceof XmlSchemaSimpleTypeList) {
                         mObj = Arrays.asList((Object[])mObj);
                         writeObject(u, source, new JAXBElement(elName, cls, mObj));
                     } else if (part.getMessageInfo().getOperation().isUnwrapped()
-                        && (mObj.getClass().isArray() || mObj instanceof List)
-                        && el.getMaxOccurs() != 1) {
-                        //Have to handle this ourselves....  which really sucks.... but what can we do?
+                               && (mObj.getClass().isArray() || mObj instanceof List)
+                               && el.getMaxOccurs() != 1) {
+                        // Have to handle this ourselves.... which really
+                        // sucks.... but what can we do?
                         Object objArray;
                         if (mObj instanceof List) {
                             List l = (List)mObj;
@@ -178,16 +181,14 @@
                         int len = Array.getLength(objArray);
                         for (int x = 0; x < len; x++) {
                             Object o = Array.get(objArray, x);
-                            writeObject(u, source, 
-                                        new JAXBElement(elName, cls == null ? o.getClass() : cls , 
-                                            o));
+                            writeObject(u, source, new JAXBElement(elName, cls == null ? o.getClass() : cls,
+                                                                   o));
                         }
                     } else {
                         writeObject(u, source, new JAXBElement(elName, cls, mObj));
                     }
-                } else if (byte[].class == cls
-                    && part.getTypeQName() != null
-                    && part.getTypeQName().getLocalPart().equals("hexBinary")) {
+                } else if (byte[].class == cls && part.getTypeQName() != null
+                           && part.getTypeQName().getLocalPart().equals("hexBinary")) {
                     mObj = new HexBinaryAdapter().marshal((byte[])mObj);
                     writeObject(u, source, new JAXBElement(elName, String.class, mObj));
                 } else {
@@ -201,22 +202,91 @@
         } catch (Exception ex) {
             if (ex instanceof javax.xml.bind.MarshalException) {
                 javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
-                Message faultMessage = new Message("MARSHAL_ERROR",
-                                                   BUNDLE, marshalEx.getLinkedException().getMessage());
-                throw new Fault(faultMessage, ex); 
+                Message faultMessage = new Message("MARSHAL_ERROR", BUNDLE, marshalEx.getLinkedException()
+                    .getMessage());
+                throw new Fault(faultMessage, ex);
             } else {
                 throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, ex.getMessage()), ex);
-            }                       
+            }
         }
     }
+    //TODO: cache the JAXBRIContext
     @SuppressWarnings("unchecked")
-    public static void marshallException(JAXBContext context, 
-                                Schema schema, 
-                                Exception elValue, 
-                                MessagePartInfo part,
-                                Object source, 
-                                AttachmentMarshaller am,
-                                Map<String, Object> marshallerProperties) {
+    public static void marshalWithBridge(TypeReference ref, Object elValue,
+                                         Object source, AttachmentMarshaller am) {
+        List<TypeReference> typeRefs = new CopyOnWriteArrayList<TypeReference>();
+        typeRefs.add(ref);
+        try {
+            JAXBRIContext riContext = JAXBRIContext.newInstance(new Class[] {ref.type.getClass()},
+                                                                    typeRefs, null, null, true, null);
+            Bridge bridge = riContext.createBridge(ref);
+
+            if (source instanceof XMLStreamWriter) {
+                bridge.marshal(elValue, (XMLStreamWriter)source);
+            } else if (source instanceof OutputStream) {
+                //the namespace is missing when marshal the xsd:QName type 
+                //to the OutputStream directly 
+                java.io.StringWriter sw = new java.io.StringWriter();
+                StreamResult s1 = new StreamResult(sw);
+                bridge.marshal(elValue, s1);
+                ((OutputStream)source).write(sw.toString().getBytes());
+            } else if (source instanceof Node) {
+                bridge.marshal(elValue, (Node)source);
+            } else {
+                throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            if (ex instanceof javax.xml.bind.MarshalException) {
+                javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
+                Message faultMessage = new Message("MARSHAL_ERROR", BUNDLE, marshalEx.getLinkedException()
+                    .getMessage());
+                throw new Fault(faultMessage, ex);
+            } else {
+                throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, ex.getMessage()), ex);
+            }
+        }
+
+    }
+    
+//  TODO: cache the JAXBRIContext
+    @SuppressWarnings("unchecked")
+    public static Object unmarshalWithBridge(TypeReference ref, Object source, AttachmentUnmarshaller am) {
+        List<TypeReference> typeRefs = new CopyOnWriteArrayList<TypeReference>();
+        typeRefs.add(ref);
+        try {
+            JAXBRIContext riContext = JAXBRIContext.newInstance(new Class[] {ref.type.getClass()},
+                                                                    typeRefs, null, null, true, null);
+            Bridge bridge = riContext.createBridge(ref);
+           
+            if (source instanceof XMLStreamReader) {
+                //DOMUtils.writeXml(StaxUtils.read((XMLStreamReader)source), System.out);
+                return bridge.unmarshal((XMLStreamReader)source);               
+            } else if (source instanceof InputStream) {
+                return bridge.unmarshal((InputStream)source);
+            } else if (source instanceof Node) {
+                return bridge.unmarshal((Node)source, am);
+            } else {
+                throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));
+            }
+        } catch (Exception ex) {
+            if (ex instanceof javax.xml.bind.MarshalException) {
+                javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
+                Message faultMessage = new Message("MARSHAL_ERROR", BUNDLE, marshalEx.getLinkedException()
+                    .getMessage());
+                throw new Fault(faultMessage, ex);
+            } else {
+                throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, ex.getMessage()), ex);
+            }
+        }
+
+    }    
+    
+
+    @SuppressWarnings("unchecked")
+    public static void marshallException(JAXBContext context, Schema schema, Exception elValue,
+                                         MessagePartInfo part, Object source, AttachmentMarshaller am,
+                                         Map<String, Object> marshallerProperties) {
         XMLStreamWriter writer = getStreamWriter(source);
         QName qn = part.getElementQName();
         try {
@@ -226,7 +296,7 @@
             if (accessorType == null && cls.getPackage() != null) {
                 accessorType = cls.getPackage().getAnnotation(XmlAccessorType.class);
             }
-            XmlAccessType accessType = accessorType != null 
+            XmlAccessType accessType = accessorType != null
                 ? accessorType.value() : XmlAccessType.PUBLIC_MEMBER;
             String namespace = part.getElementQName().getNamespaceURI();
             Marshaller u = createMarshaller(context, cls, marshallerProperties);
@@ -240,7 +310,6 @@
                 // intentionally empty.
             }
 
-            
             for (Field f : cls.getDeclaredFields()) {
                 if (JAXBContextInitializer.isFieldAccepted(f, accessType)) {
                     QName fname = new QName(namespace, f.getName());
@@ -257,29 +326,27 @@
                     writeObject(u, writer, new JAXBElement(mname, String.class, m.invoke(elValue)));
                 }
             }
-            
+
             writer.writeEndElement();
             writer.flush();
         } catch (Exception e) {
             throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, e.getMessage()), e);
         }
     }
+
     @SuppressWarnings("unchecked")
-    public static Exception unmarshallException(JAXBContext context, 
-                                    Schema schema, 
-                                    Object source,
-                                    MessagePartInfo part, 
-                                    AttachmentUnmarshaller au) {
+    public static Exception unmarshallException(JAXBContext context, Schema schema, Object source,
+                                                MessagePartInfo part, AttachmentUnmarshaller au) {
         XMLStreamReader reader;
         if (source instanceof XMLStreamReader) {
             reader = (XMLStreamReader)source;
         } else if (source instanceof Element) {
             reader = StaxUtils.createXMLStreamReader((Element)source);
             try {
-                //advance into the node 
+                // advance into the node
                 reader.nextTag();
             } catch (XMLStreamException e) {
-                //ignore
+                // ignore
             }
         } else {
             throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));
@@ -289,7 +356,7 @@
             if (!qn.equals(reader.getName())) {
                 throw new Fault(new Message("ELEMENT_NAME_MISMATCH", BUNDLE, qn, reader.getName()));
             }
-            
+
             Class<?> cls = part.getTypeClass();
             Object obj = null;
             try {
@@ -299,12 +366,12 @@
                 Constructor cons = cls.getConstructor(new Class[] {String.class});
                 obj = cons.newInstance(new Object[1]);
             }
-            
+
             XmlAccessorType accessorType = cls.getAnnotation(XmlAccessorType.class);
             if (accessorType == null && cls.getPackage() != null) {
                 accessorType = cls.getPackage().getAnnotation(XmlAccessorType.class);
             }
-            XmlAccessType accessType = accessorType != null 
+            XmlAccessType accessType = accessorType != null
                 ? accessorType.value() : XmlAccessType.PUBLIC_MEMBER;
             Unmarshaller u = createUnmarshaller(context, cls);
             try {
@@ -325,8 +392,8 @@
                         f.set(obj, u.unmarshal(reader, f.getType()));
                     }
                 } catch (NoSuchFieldException ex) {
-                    String s = Character.toUpperCase(q.getLocalPart().charAt(0)) 
-                        + q.getLocalPart().substring(1);
+                    String s = Character.toUpperCase(q.getLocalPart().charAt(0))
+                               + q.getLocalPart().substring(1);
                     Method m = null;
                     try {
                         m = cls.getMethod("get" + s);
@@ -343,8 +410,8 @@
             throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, e.getMessage()), e);
         }
     }
-    
-    private static void writeObject(Marshaller u, Object source, Object mObj) throws Fault, JAXBException { 
+
+    private static void writeObject(Marshaller u, Object source, Object mObj) throws Fault, JAXBException {
         if (source instanceof XMLStreamWriter) {
             u.marshal(mObj, (XMLStreamWriter)source);
         } else if (source instanceof OutputStream) {
@@ -357,7 +424,8 @@
             throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));
         }
     }
-    private static XMLStreamWriter getStreamWriter(Object source) throws Fault { 
+
+    private static XMLStreamWriter getStreamWriter(Object source) throws Fault {
         if (source instanceof XMLStreamWriter) {
             return (XMLStreamWriter)source;
         } else if (source instanceof OutputStream) {
@@ -372,12 +440,11 @@
                                 Map<String, Object> marshallerProperties) {
         marshall(context, schema, elValue, null, source, null, marshallerProperties);
     }
-    
+
     @SuppressWarnings("unchecked")
-    public static void marshallNullElement(JAXBContext context, Schema schema, 
-                                           Object source, MessagePartInfo part,
-                                           Map<String, Object> marshallerProperties) {
-        Class<?> clazz = part != null ? (Class) part.getTypeClass() : null;
+    public static void marshallNullElement(JAXBContext context, Schema schema, Object source,
+                                           MessagePartInfo part, Map<String, Object> marshallerProperties) {
+        Class<?> clazz = part != null ? (Class)part.getTypeClass() : null;
         try {
             Marshaller u = createMarshaller(context, clazz, marshallerProperties);
             u.setSchema(schema);
@@ -392,14 +459,11 @@
             writeObject(u, source, new JAXBElement(part.getElementQName(), clazz, null));
         } catch (JAXBException e) {
             throw new Fault(new Message("MARSHAL_ERROR", BUNDLE, e.getMessage()), e);
-        } 
+        }
     }
 
-    public static void marshall(JAXBContext context, Schema schema, 
-                                Object elValue, 
-                                MessagePartInfo part,
-                                Object source,
-                                Map<String, Object> marshallerProperties) {
+    public static void marshall(JAXBContext context, Schema schema, Object elValue, MessagePartInfo part,
+                                Object source, Map<String, Object> marshallerProperties) {
         marshall(context, schema, elValue, part, source, null, marshallerProperties);
     }
 
@@ -422,109 +486,89 @@
     }
 
     @SuppressWarnings("unchecked")
-    public static Object unmarshall(JAXBContext context, 
-                                    Schema schema, 
-                                    Object source,
-                                    MessagePartInfo part, 
-                                    AttachmentUnmarshaller au, 
-                                    boolean unwrap) {
-        Class<?> clazz = part != null ? (Class) part.getTypeClass() : null;
-        if (clazz != null 
-            && Exception.class.isAssignableFrom(clazz)
-            && part != null
-            && Boolean.TRUE.equals(part.getProperty(JAXBDataBinding.class.getName() 
-                                                    + ".CUSTOM_EXCEPTION"))) {
+    public static Object unmarshall(JAXBContext context, Schema schema, Object source, MessagePartInfo part,
+                                    AttachmentUnmarshaller au, boolean unwrap) {
+        Class<?> clazz = part != null ? (Class)part.getTypeClass() : null;
+        if (clazz != null && Exception.class.isAssignableFrom(clazz) && part != null
+            && Boolean.TRUE.equals(part.getProperty(JAXBDataBinding.class.getName() + ".CUSTOM_EXCEPTION"))) {
             return unmarshallException(context, schema, source, part, au);
         }
-        
+
         QName elName = part != null ? part.getConcreteName() : null;
-        if (clazz != null
-            && clazz.isArray()
-            && part != null 
+        if (clazz != null && clazz.isArray() && part != null
             && part.getXmlSchema() instanceof XmlSchemaElement) {
             XmlSchemaElement el = (XmlSchemaElement)part.getXmlSchema();
-            
+
             if (el.getSchemaType() instanceof XmlSchemaSimpleType
-                && ((XmlSchemaSimpleType)el.getSchemaType()).getContent()
+                && ((XmlSchemaSimpleType)el.getSchemaType()).getContent() 
                 instanceof XmlSchemaSimpleTypeList) {
-                
+
                 Object obj = unmarshall(context, schema, source, elName, null, au, unwrap);
-                if (clazz.isArray()
-                    && obj instanceof List) {
+                if (clazz.isArray() && obj instanceof List) {
                     return ((List)obj).toArray((Object[])Array.newInstance(clazz.getComponentType(),
-                                                                 ((List)obj).size()));
+                                                                           ((List)obj).size()));
                 }
-                    
+
                 return obj;
-            } else if (part.getMessageInfo().getOperation().isUnwrapped()
-                        && el.getMaxOccurs() != 1) {
-                //must read ourselves....
-                List<Object> ret = unmarshallArray(context, schema, source,
-                                                   elName, clazz.getComponentType(),
+            } else if (part.getMessageInfo().getOperation().isUnwrapped() && el.getMaxOccurs() != 1) {
+                // must read ourselves....
+                List<Object> ret = unmarshallArray(context, schema, source, elName, clazz.getComponentType(),
                                                    au, createList(part));
                 Object o = ret;
                 if (!isList(part)) {
                     if (clazz.getComponentType().isPrimitive()) {
-                        o = java.lang.reflect.Array.newInstance(clazz.getComponentType(),
-                                                                     ret.size());
+                        o = java.lang.reflect.Array.newInstance(clazz.getComponentType(), ret.size());
                         for (int x = 0; x < ret.size(); x++) {
                             Array.set(o, x, ret.get(x));
                         }
                     } else {
-                        o = ret.toArray((Object[])Array.newInstance(clazz.getComponentType(),
-                                                                       ret.size()));
+                        o = ret.toArray((Object[])Array.newInstance(clazz.getComponentType(), ret.size()));
                     }
                 }
                 return o;
             }
-        } else if (byte[].class == clazz
-            && part != null 
-            && part.getTypeQName() != null
-            && part.getTypeQName().getLocalPart().equals("hexBinary")) {
-            
+        } else if (byte[].class == clazz && part != null && part.getTypeQName() != null
+                   && part.getTypeQName().getLocalPart().equals("hexBinary")) {
+
             String obj = (String)unmarshall(context, schema, source, elName, String.class, au, unwrap);
             return new HexBinaryAdapter().unmarshal(obj);
         }
 
         Object o = unmarshall(context, schema, source, elName, clazz, au, unwrap);
-        if (o != null
-            && o.getClass().isArray()
-            && isList(part)) {
+        if (o != null && o.getClass().isArray() && isList(part)) {
             List<Object> ret = createList(part);
             ret.addAll(Arrays.asList((Object[])o));
             o = ret;
         }
         return o;
     }
-    
+
     private static List<Object> createList(MessagePartInfo part) {
         Type genericType = (Type)part.getProperty("generic.type");
         if (genericType instanceof ParameterizedType) {
             Type tp2 = ((ParameterizedType)genericType).getRawType();
             if (tp2 instanceof Class) {
                 Class<?> cls = (Class)tp2;
-                if (!cls.isInterface()
-                    && List.class.isAssignableFrom((Class<?>)cls)) {
+                if (!cls.isInterface() && List.class.isAssignableFrom((Class<?>)cls)) {
                     try {
                         return CastUtils.cast((List)cls.newInstance());
                     } catch (Exception e) {
-                        //ignore, just return an ArrayList
+                        // ignore, just return an ArrayList
                     }
                 }
             }
         }
-        
+
         return new ArrayList<Object>();
     }
-    
+
     private static boolean isList(MessagePartInfo part) {
-        if (part.getTypeClass().isArray()
-            && !part.getTypeClass().getComponentType().isPrimitive()) {
-            //&& Collection.class.isAssignableFrom(part.getTypeClass())) {
-            //it's List Para
+        if (part.getTypeClass().isArray() && !part.getTypeClass().getComponentType().isPrimitive()) {
+            // && Collection.class.isAssignableFrom(part.getTypeClass())) {
+            // it's List Para
             //
-            Type genericType = (Type) part.getProperty("generic.type");
-            
+            Type genericType = (Type)part.getProperty("generic.type");
+
             if (genericType instanceof ParameterizedType) {
                 Type tp2 = ((ParameterizedType)genericType).getRawType();
                 if (tp2 instanceof Class) {
@@ -534,15 +578,11 @@
         }
         return false;
     }
-    public static Object unmarshall(JAXBContext context, 
-                                    Schema schema, 
-                                    Object source,
-                                    QName elName,
-                                    Class<?> clazz,
-                                    AttachmentUnmarshaller au, 
-                                    boolean unwrap) {
+
+    public static Object unmarshall(JAXBContext context, Schema schema, Object source, QName elName,
+                                    Class<?> clazz, AttachmentUnmarshaller au, boolean unwrap) {
         Object obj = null;
-        
+
         try {
             Unmarshaller u = createUnmarshaller(context, clazz);
             u.setSchema(schema);
@@ -550,22 +590,23 @@
                 u.setAttachmentUnmarshaller(au);
             }
             boolean unmarshalWithClass = true;
-            
-            if (clazz == null || (!clazz.isPrimitive() && !clazz.isArray() && !clazz.isEnum() 
-                && (Modifier.isAbstract(clazz.getModifiers()) 
-                || Modifier.isInterface(clazz.getModifiers())))) {
+
+            if (clazz == null
+                || (!clazz.isPrimitive() && !clazz.isArray() && !clazz.isEnum() && (Modifier.isAbstract(clazz
+                    .getModifiers()) || Modifier.isInterface(clazz.getModifiers())))) {
                 unmarshalWithClass = false;
-            } 
-            
-            if (clazz != null && (clazz.getName().equals("javax.xml.datatype.XMLGregorianCalendar")
-                    || clazz.getName().equals("javax.xml.datatype.Duration"))) {
-                //special treat two jaxb defined built-in abstract types
+            }
+
+            if (clazz != null
+                && (clazz.getName().equals("javax.xml.datatype.XMLGregorianCalendar") || clazz.getName()
+                    .equals("javax.xml.datatype.Duration"))) {
+                // special treat two jaxb defined built-in abstract types
                 unmarshalWithClass = true;
             }
             if (source instanceof Node) {
                 obj = unmarshalWithClass ? u.unmarshal((Node)source, clazz) : u.unmarshal((Node)source);
             } else if (source instanceof XMLStreamReader) {
-                
+
                 obj = unmarshalWithClass ? u.unmarshal((XMLStreamReader)source, clazz) : u
                     .unmarshal((XMLStreamReader)source);
             } else if (source instanceof XMLEventReader) {
@@ -577,11 +618,11 @@
         } catch (Fault ex) {
             ex.fillInStackTrace();
             throw ex;
-        } catch (Exception ex) {                        
-            if (ex instanceof javax.xml.bind.UnmarshalException) {                
+        } catch (Exception ex) {
+            if (ex instanceof javax.xml.bind.UnmarshalException) {
                 javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;
-                throw new Fault(new Message("UNMARSHAL_ERROR", 
-                                            BUNDLE, unmarshalEx.getLinkedException().getMessage()), ex); 
+                throw new Fault(new Message("UNMARSHAL_ERROR", BUNDLE, unmarshalEx.getLinkedException()
+                    .getMessage()), ex);
             } else {
                 throw new Fault(new Message("UNMARSHAL_ERROR", BUNDLE, ex.getMessage()), ex);
             }
@@ -599,7 +640,7 @@
         }
         return obj;
     }
-    
+
     public static Class<?> getClassFromType(Type t) {
         if (t instanceof Class) {
             return (Class)t;
@@ -616,14 +657,10 @@
         assert false;
         throw new IllegalArgumentException("Cannot get Class object from unknown Type");
     }
-    
-    public static List<Object> unmarshallArray(JAXBContext context, 
-                                    Schema schema, 
-                                    Object source,
-                                    QName elName,
-                                    Class<?> clazz,
-                                    AttachmentUnmarshaller au,
-                                    List<Object> ret) {
+
+    public static List<Object> unmarshallArray(JAXBContext context, Schema schema, Object source,
+                                               QName elName, Class<?> clazz, AttachmentUnmarshaller au,
+                                               List<Object> ret) {
         try {
             Unmarshaller u = createUnmarshaller(context, clazz);
             u.setSchema(schema);
@@ -653,14 +690,14 @@
         } catch (Fault ex) {
             ex.fillInStackTrace();
             throw ex;
-        } catch (Exception ex) {                        
-            if (ex instanceof javax.xml.bind.UnmarshalException) {                
+        } catch (Exception ex) {
+            if (ex instanceof javax.xml.bind.UnmarshalException) {
                 javax.xml.bind.UnmarshalException unmarshalEx = (javax.xml.bind.UnmarshalException)ex;
-                throw new Fault(new Message("UNMARSHAL_ERROR", 
-                                            BUNDLE, unmarshalEx.getLinkedException().getMessage()), ex); 
+                throw new Fault(new Message("UNMARSHAL_ERROR", BUNDLE, unmarshalEx.getLinkedException()
+                    .getMessage()), ex);
             } else {
                 throw new Fault(new Message("UNMARSHAL_ERROR", BUNDLE, ex.getMessage()), ex);
             }
-        } 
+        }
     }
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataReaderImpl.java Mon Jan  7 20:39:51 2008
@@ -19,9 +19,13 @@
 
 package org.apache.cxf.jaxb.io;
 
+import java.lang.annotation.Annotation;
+
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
 
+import com.sun.xml.bind.api.TypeReference;
+
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.jaxb.JAXBDataBase;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
@@ -37,6 +41,21 @@
     }
 
     public Object read(MessagePartInfo part, T reader) {
+        boolean honorJaxbAnnotation = false;
+        if (part != null && part.getProperty("honor.jaxb.annotations") != null) {
+            honorJaxbAnnotation = (Boolean)part.getProperty("honor.jaxb.annotations");
+        }
+        Annotation[] anns = getJAXBAnnotion(part);
+        if (honorJaxbAnnotation && anns.length > 0) {
+            //RpcLit will use the JAXB Bridge to unmarshall part message when it is 
+            //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
+            //TODO:Cache the JAXBRIContext
+            QName qname = new QName(null, part.getConcreteName().getLocalPart());
+            TypeReference typeReference = new TypeReference(qname, part.getTypeClass(), anns);
+            return JAXBEncoderDecoder.unmarshalWithBridge(typeReference, reader, 
+                                                          getAttachmentUnmarshaller());
+        }
+        
         return JAXBEncoderDecoder.unmarshall(getJAXBContext(), getSchema(), reader, part, 
                                              getAttachmentUnmarshaller(), unwrapJAXBElement);
     }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/DataWriterImpl.java Mon Jan  7 20:39:51 2008
@@ -19,10 +19,14 @@
 
 package org.apache.cxf.jaxb.io;
 
+import java.lang.annotation.Annotation;
 import java.util.Collections;
 import java.util.Map;
 
 import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+
+import com.sun.xml.bind.api.TypeReference;
 
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.jaxb.JAXBDataBase;
@@ -49,6 +53,11 @@
     }
     
     public void write(Object obj, MessagePartInfo part, T output) {
+        boolean honorJaxbAnnotation = false;
+        if (part != null && part.getProperty("honor.jaxb.annotations") != null) {
+            honorJaxbAnnotation = (Boolean)part.getProperty("honor.jaxb.annotations");
+        }
+        
         if (obj != null
             || !(part.getXmlSchema() instanceof XmlSchemaElement)) {
             
@@ -60,9 +69,19 @@
                                                      part, output, getAttachmentMarshaller(),
                                                      marshallerProperties);                
             } else {
-                JAXBEncoderDecoder.marshall(getJAXBContext(), getSchema(), obj, part, output, 
-                                        getAttachmentMarshaller(),
-                                        marshallerProperties);
+                Annotation[] anns = getJAXBAnnotion(part);
+                if (!honorJaxbAnnotation || anns.length == 0) {
+                    JAXBEncoderDecoder.marshall(getJAXBContext(), getSchema(), obj, part, output,
+                                                getAttachmentMarshaller(), marshallerProperties);
+                } else if (honorJaxbAnnotation && anns.length > 0) {
+                    //RpcLit will use the JAXB Bridge to marshall part message when it is 
+                    //annotated with @XmlList,@XmlAttachmentRef,@XmlJavaTypeAdapter
+                    //TODO:Cache the JAXBRIContext
+                    QName qname = new QName(null, part.getConcreteName().getLocalPart());
+                    TypeReference typeReference = new TypeReference(qname, part.getTypeClass(), anns);
+                    JAXBEncoderDecoder.marshalWithBridge(typeReference, obj, 
+                                                         output, getAttachmentMarshaller());
+                }
             }
         } else if (obj == null && needToRender(obj, part)) {
             JAXBEncoderDecoder.marshallNullElement(getJAXBContext(), getSchema(), output, part,
@@ -85,4 +104,7 @@
     public void setMarshallerProperties(Map<String, Object> marshallerProperties) {
         this.marshallerProperties = marshallerProperties;
     }
+    
+
+    
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java Mon Jan  7 20:39:51 2008
@@ -313,7 +313,7 @@
             if (bindingUri != null) {
                 serverFactory.setBindingId(bindingUri);
             }
-            
+
             if (serviceName != null) {
                 serverFactory.getServiceFactory().setServiceName(serviceName);
             }

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=609869&r1=609868&r2=609869&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java Mon Jan  7 20:39:51 2008
@@ -126,6 +126,7 @@
     public static final String METHOD = "operation.method";
     public static final String METHOD_PARAM_ANNOTATIONS = "method.parameters.annotations";
     public static final String METHOD_ANNOTATIONS = "method.return.annotations";
+    public static final String PARAM_ANNOTATION = "parameter.annotations";
     private static final Logger LOG = LogUtils.getL7dLogger(ReflectionServiceFactoryBean.class,
                                                             "SimpleMessages");
 
@@ -571,7 +572,8 @@
 
             setFaultClassInfo(o, method);
         }
-
+        o.setProperty(METHOD_PARAM_ANNOTATIONS, method.getParameterAnnotations());
+        o.setProperty(METHOD_ANNOTATIONS, method.getAnnotations());
         Class<?>[] paramTypes = method.getParameterTypes();
         Type[] genericTypes = method.getGenericParameterTypes();
         for (int i = 0; i < paramTypes.length; i++) {
@@ -600,6 +602,13 @@
                                      Class paramType, Type genericType) {
         boolean isIn = isInParam(method, i);
         boolean isOut = isOutParam(method, i);
+        Annotation[] paraAnnos = null;
+        if (i != -1 && o.getProperty(METHOD_PARAM_ANNOTATIONS) != null) {
+            Annotation[][] anns = (Annotation[][])o.getProperty(METHOD_PARAM_ANNOTATIONS);
+            paraAnnos = anns[i];
+        } else if (i == -1 && o.getProperty(METHOD_ANNOTATIONS) != null) {
+            paraAnnos = (Annotation[])o.getProperty(METHOD_ANNOTATIONS);
+        }
 
         MessagePartInfo part = null;
         if (isIn && !isOut) {
@@ -612,6 +621,7 @@
                 return false;
             }
             initializeParameter(part, paramType, genericType);
+            
             part.setIndex(i);
         } else if (!isIn && isOut) {
             QName name = getOutPartName(o, method, i);
@@ -646,6 +656,9 @@
             initializeParameter(part, paramType, genericType);
             part.setIndex(i + 1);
         }
+        if (paraAnnos != null && part != null) {
+            part.setProperty(PARAM_ANNOTATION, paraAnnos);
+        }
         return true;
     }    
     private void setFaultClassInfo(OperationInfo o, Method selected) {
@@ -711,6 +724,7 @@
         OperationInfo op = intf.addOperation(getOperationName(intf, m));
         op.setProperty(m.getClass().getName(), m);
         op.setProperty("action", getAction(op, m));
+        op.setProperty(METHOD_ANNOTATIONS, m.getAnnotations());
 
         if (isWrapped(m)) {
             UnwrappedOperationInfo uOp = new UnwrappedOperationInfo(op);
@@ -1144,6 +1158,7 @@
     private Map<Class, Boolean> getJaxbAnnoMap(MessagePartInfo mpi) {
         Map<Class, Boolean> map = new ConcurrentHashMap<Class, Boolean>();
         Annotation[] anns = getMethodParameterAnnotations(mpi);
+       
         if (anns != null) {
             for (Annotation anno : anns) {
                 if (anno instanceof XmlList) {
@@ -1217,7 +1232,9 @@
                 final QName q2 = getInPartName(op, method, j);
                 MessagePartInfo part = inMsg.addMessagePart(q2);
                 initializeParameter(part, paramClasses[j], method.getGenericParameterTypes()[j]);
+                //TODO:remove method param annotations
                 part.setProperty(METHOD_PARAM_ANNOTATIONS, method.getParameterAnnotations());
+                part.setProperty(PARAM_ANNOTATION, method.getParameterAnnotations()[j]);
                 if (getJaxbAnnoMap(part).size() > 0) {
                     op.setProperty(WRAPPERGEN_NEEDED, true);
                 }

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/Server.java?rev=609869&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/Server.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/Server.java Mon Jan  7 20:39:51 2008
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.stringarray;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class Server extends AbstractBusTestServerBase {
+    protected void run() {
+        Object implementor = new StringArrayTestImpl();
+        String address = "http://localhost:9999/SOAPServiceRPCLit/SoapPort";
+        // http://localhost:9992/SOAPServiceRPCLit/SoapPort
+        try {            
+            Endpoint.publish(address, implementor);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Thread.currentThread().interrupt();
+        }
+    }
+
+    public static void main(String args[]) {
+        try {
+            Server s = new Server();
+            s.start();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            System.exit(-1);
+        } finally {
+            System.out.println("done!");
+        }
+    }
+
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTest.java?rev=609869&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTest.java Mon Jan  7 20:39:51 2008
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.stringarray;
+
+import java.io.StringWriter;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.stringarray.SOAPServiceRPCLit;
+import org.apache.stringarray.StringListTest;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class StringArrayTest extends AbstractBusClientServerTestBase {
+
+    @BeforeClass
+    public static void startServers() throws Exception {
+        assertTrue("server did not launch correctly", launchServer(Server.class));
+    }
+    
+    @AfterClass
+    public static void stopAllServers() throws Exception {
+        
+    }
+    
+    @Test
+    public void testStringArrayList() throws Exception {
+        SpringBusFactory factory = new SpringBusFactory();
+        Bus bus = factory.createBus();
+        BusFactory.setDefaultBus(bus);
+        setBus(bus);
+        StringWriter swin = new java.io.StringWriter();
+        java.io.PrintWriter pwin = new java.io.PrintWriter(swin);
+        LoggingInInterceptor logIn = new LoggingInInterceptor(pwin);
+        
+        StringWriter swout = new java.io.StringWriter();
+        java.io.PrintWriter pwout = new java.io.PrintWriter(swout);
+        LoggingOutInterceptor logOut = new LoggingOutInterceptor(pwout);
+        
+        
+        getBus().getInInterceptors().add(logIn);
+        getBus().getOutInterceptors().add(logOut);
+        SOAPServiceRPCLit service = new SOAPServiceRPCLit();
+        StringListTest port = service.getSoapPortRPCLit();
+        String[] strs = new String[]{"org", "apache", "cxf"};
+        String[] res =  port.stringListTest(strs);
+        assertArrayEquals(strs, res);      
+
+        assertTrue("Request message is not marshalled correctly and @XmlList does not take effect",
+                     swout.toString().indexOf("<in>org apache cxf</in>") > -1);
+        assertTrue("Response message is not marshalled correctly and @XmlList does not take effect",
+                     swin.toString().indexOf("<out>org apache cxf</out>") > -1);
+    }
+    
+}

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTestImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTestImpl.java?rev=609869&view=auto
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTestImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/stringarray/StringArrayTestImpl.java Mon Jan  7 20:39:51 2008
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.stringarray;
+import org.apache.stringarray.StringListTest;
+
+
+public class StringArrayTestImpl implements StringListTest {
+    public String[] stringListTest(String[] in) {
+        for (String str : in) {
+            System.out.println("--str-- " + str);
+        }
+        return in;
+    }
+
+}

Added: incubator/cxf/trunk/testutils/src/main/resources/wsdl/string_array_test.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/string_array_test.wsdl?rev=609869&view=auto
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/string_array_test.wsdl (added)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/string_array_test.wsdl Mon Jan  7 20:39:51 2008
@@ -0,0 +1,83 @@
+<?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.
+-->
+<wsdl:definitions name="HelloWorld"
+	targetNamespace="http://apache.org/stringarray"
+	xmlns="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:tns="http://apache.org/stringarray"
+	xmlns:x1="http://apache.org/stringarray/types"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+	<wsdl:types>
+		<schema targetNamespace="http://apache.org/stringarray/types"
+			xmlns="http://www.w3.org/2001/XMLSchema"
+			elementFormDefault="qualified">
+			  <simpleType name="StringListType">
+			    <list itemType="string" />
+                          </simpleType>>
+		</schema>
+	</wsdl:types>
+
+	<wsdl:message name="StringListRequest">
+		<wsdl:part type="x1:StringListType" name="in"/>
+	</wsdl:message>
+
+	<wsdl:message name="IntegerRangeResponse">
+		<wsdl:part type="x1:StringListType" name="out"/>
+	</wsdl:message>
+
+	<wsdl:portType name="StringListTest">
+		<wsdl:operation name="StringListTest">
+			<wsdl:input message="tns:StringListRequest"
+				name="stringListRequest" />
+			<wsdl:output message="tns:IntegerRangeResponse"
+				name="integerRangeResponse" />
+		</wsdl:operation>
+
+	</wsdl:portType>
+
+	<wsdl:binding name="Test_SOAPBinding_RPCLit"
+		type="tns:StringListTest">
+
+		<soap:binding style="rpc"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+
+		<wsdl:operation name="StringListTest">
+			<soap:operation soapAction="" style="rpc" />
+			<wsdl:input>
+				<soap:body namespace="http://apache.org/stringarray"
+					use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body namespace="http://apache.org/stringarray"
+					use="literal" />
+			</wsdl:output>
+		</wsdl:operation>
+	</wsdl:binding>
+
+	<wsdl:service name="SOAPServiceRPCLit">
+		<wsdl:port binding="tns:Test_SOAPBinding_RPCLit"
+			name="SoapPortRPCLit">
+			<soap:address
+				location="http://localhost:9992/SOAPServiceRPCLit/SoapPort" />
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>



Mime
View raw message