cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r469066 [2/3] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/configuration/spring/ common/common/src/test/java/org/apache/c...
Date Mon, 30 Oct 2006 04:56:24 GMT
Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataReader.java Sun Oct 29 20:56:21 2006
@@ -19,13 +19,13 @@
 
 package org.apache.cxf.jaxb.io;
 
-
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
 
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class EventDataReader implements DataReader<XMLEventReader> {
     final JAXBDataReaderFactory factory;
@@ -38,16 +38,17 @@
         return read(null, input);
     }
 
-    public Object read(QName name, XMLEventReader reader) {
-        return read(name, reader, null);
+    public Object read(QName name, XMLEventReader input, Class type) {
+        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(), factory.getSchema(), input, name,
+                                             type, null);
     }
-    
-    public Object read(QName name, XMLEventReader reader, Class cls) {
-        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(),
-                                             factory.getSchema(),
-                                             reader,
-                                             name,
-                                             cls, 
+
+    public Object read(MessagePartInfo part, XMLEventReader input) {
+        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(), 
+                                             factory.getSchema(), 
+                                             input,
+                                             part,
                                              null);
-    }    
+    }
+
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataWriter.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataWriter.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/EventDataWriter.java Sun Oct 29 20:56:21 2006
@@ -19,12 +19,12 @@
 
 package org.apache.cxf.jaxb.io;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventWriter;
 
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.jaxb.JAXBDataWriterFactory;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class EventDataWriter implements DataWriter<XMLEventWriter> {
     final JAXBDataWriterFactory factory;
@@ -37,19 +37,11 @@
         write(obj, null, output);
     }
     
-    public void write(Object obj, QName elName, XMLEventWriter output) {
+    public void write(Object obj, MessagePartInfo part, XMLEventWriter output) {
         if (obj != null) {
             JAXBEncoderDecoder.marshall(factory.getJAXBContext(),
                                         factory.getSchema(), obj,
-                                        elName, output, null);
+                                        part, output, null);
         }
     }
-    /*
-    public void writeWrapper(ObjectMessageContext objCtx, boolean isOutBound, T output) {
-        Object obj = callback.createWrapperType(objCtx, isOutBound);
-        QName elName = isOutBound ? callback.getResponseWrapperQName()
-                                  : callback.getRequestWrapperQName();
-        write(obj, elName, output);
-    }
-    */
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataReader.java Sun Oct 29 20:56:21 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.jaxb.io;
 
-import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
 import javax.xml.stream.XMLStreamReader;
@@ -32,6 +31,7 @@
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
 import org.apache.cxf.jaxb.attachment.JAXBAttachmentUnmarshaller;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class MessageDataReader implements DataReader<Message> {
     
@@ -45,11 +45,7 @@
         return read(null, input);
     }
     
-    public Object read(QName name, Message input) {
-        return read(name, input, null);
-    }
-    
-    public Object read(QName name, Message input, Class cls) {
+    public Object read(MessagePartInfo part, Message input) {
         JAXBAttachmentUnmarshaller au = null;        
         if (input.get(AttachmentDeserializer.class) != null) {
             au = new JAXBAttachmentUnmarshaller(input);            
@@ -71,20 +67,17 @@
             return null;
         }
         Object o = JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(),
-                                                 factory.getSchema(), source,
-                                                 name,
-                                                 cls, 
+                                                 factory.getSchema(), 
+                                                 source,
+                                                 part, 
                                                  au);
-        o = getValue(o);
-        
         return o;
     }
 
-    private Object getValue(Object o) {
-        if (o instanceof JAXBElement) {
-            return ((JAXBElement)o).getValue();
-        }
-        return o;
+    public Object read(QName name, Message input, Class type) {
+        // TODO Auto-generated method stub
+        return null;
     }
+
 
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/MessageDataWriter.java Sun Oct 29 20:56:21 2006
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.jaxb.io;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventWriter;
 import javax.xml.stream.XMLStreamWriter;
 
@@ -30,7 +29,7 @@
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
 import org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller;
 import org.apache.cxf.message.Message;
-
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class MessageDataWriter implements DataWriter<Message> {
 
@@ -44,7 +43,7 @@
         write(obj, null, output);
     }
 
-    public void write(Object obj, QName elName, Message output) {
+    public void write(Object obj, MessagePartInfo part, Message output) {
         // if the mtom is enabled, we need to create the attachment mashaller
         JAXBAttachmentMarshaller am = null;
         if (output.containsKey(Message.MTOM_ENABLED)) {
@@ -52,15 +51,15 @@
             am.setXOPPackage(true);
         }
         Object source = null;
-        XMLStreamWriter xsw = (XMLStreamWriter) output.getContent(XMLStreamWriter.class);
+        XMLStreamWriter xsw = (XMLStreamWriter)output.getContent(XMLStreamWriter.class);
         if (xsw != null) {
             source = xsw;
         } else {
-            XMLEventWriter xew = (XMLEventWriter) output.getContent(XMLEventWriter.class);
+            XMLEventWriter xew = (XMLEventWriter)output.getContent(XMLEventWriter.class);
             if (xew != null) {
                 source = xew;
             } else {
-                Node node = (Node) output.getContent(Node.class);
+                Node node = (Node)output.getContent(Node.class);
                 source = node;
             }
         }
@@ -69,9 +68,7 @@
         }
 
         if (obj != null) {
-            JAXBEncoderDecoder.marshall(factory.getJAXBContext(), factory.getSchema(), obj, elName, source,
-                            am);
+            JAXBEncoderDecoder.marshall(factory.getJAXBContext(), factory.getSchema(), obj, part, source, am);
         }
     }
-
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataReader.java Sun Oct 29 20:56:21 2006
@@ -27,6 +27,7 @@
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class NodeDataReader implements DataReader<Node> {
     final JAXBDataReaderFactory factory;
@@ -39,18 +40,21 @@
         return read(null, input);
     }
 
-    public Object read(QName name, Node xmlNode) {
-        return read(name, xmlNode, null);
-    }
-    
-    public Object read(QName name, Node xmlNode, Class cls) {
+    public Object read(MessagePartInfo part, Node xmlNode) {
         return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(),
                                              factory.getSchema(),
                                              xmlNode,
+                                             part,
+                                             null);
+    }
+
+    public Object read(QName name, Node input, Class type) {
+        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(),
+                                             factory.getSchema(),
+                                             input,
                                              name,
-                                             cls,
+                                             type,
                                              null);
     }
     
-   
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataWriter.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataWriter.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/NodeDataWriter.java Sun Oct 29 20:56:21 2006
@@ -19,13 +19,12 @@
 
 package org.apache.cxf.jaxb.io;
 
-import javax.xml.namespace.QName;
-
 import org.w3c.dom.Node;
 
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.jaxb.JAXBDataWriterFactory;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class NodeDataWriter implements DataWriter<Node> {
     final JAXBDataWriterFactory factory;
@@ -36,11 +35,11 @@
     public void write(Object obj, Node output) {
         write(obj, null, output);
     }
-    public void write(Object obj, QName elName, Node output) {
+    public void write(Object obj, MessagePartInfo part, Node output) {
         if (obj != null) {
             JAXBEncoderDecoder.marshall(factory.getJAXBContext(),
                                         factory.getSchema(), obj,
-                                        elName, output, null);
+                                        part, output, null);
         }
     }
 

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataReader.java Sun Oct 29 20:56:21 2006
@@ -35,6 +35,7 @@
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class SOAPBodyDataReader implements DataReader<SOAPBody> {
     final JAXBDataReaderFactory factory;
@@ -48,7 +49,7 @@
         return null;
     }
 
-    public Object read(QName name, SOAPBody input) {
+    public Object read(MessagePartInfo part, SOAPBody input) {
         // Complete
         return null;
     }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataWriter.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataWriter.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPBodyDataWriter.java Sun Oct 29 20:56:21 2006
@@ -21,7 +21,6 @@
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.Marshaller;
-import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
@@ -33,6 +32,7 @@
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxb.JAXBDataWriterFactory;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class SOAPBodyDataWriter implements DataWriter<SOAPBody> {
     protected SOAPBody dest;
@@ -76,7 +76,7 @@
     
 
 
-    public void write(Object obj, QName elName, SOAPBody output) {
+    public void write(Object obj, MessagePartInfo part, SOAPBody output) {
         // Complete      
 
     }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPMessageDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPMessageDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPMessageDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/SOAPMessageDataReader.java Sun Oct 29 20:56:21 2006
@@ -33,6 +33,7 @@
 
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class SOAPMessageDataReader implements DataReader<SOAPMessage> {
     final JAXBDataReaderFactory factory;
@@ -46,8 +47,7 @@
         return null;
     }
 
-    public Object read(QName name, SOAPMessage input) {
-        // Complete
+    public Object read(MessagePartInfo part, SOAPMessage input) {
         return null;
     }
 

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLMessageDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLMessageDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLMessageDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLMessageDataReader.java Sun Oct 29 20:56:21 2006
@@ -39,6 +39,7 @@
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
 import org.apache.cxf.message.XMLMessage;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class XMLMessageDataReader implements DataReader<XMLMessage> {
     final JAXBDataReaderFactory factory;
@@ -52,17 +53,11 @@
         return null;
     }
 
-    public Object read(QName name, XMLMessage input) {
-        // Complete
+    public Object read(MessagePartInfo part, XMLMessage input) {
+        // TODO Auto-generated method stub
         return null;
     }
 
-    /**
-     * @param name
-     * @param input
-     * @param type
-     * @return
-     */
     public Object read(QName name, XMLMessage input, Class type) {
         Object obj = null;
         InputStream is = input.getContent(InputStream.class);

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataReader.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataReader.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataReader.java Sun Oct 29 20:56:21 2006
@@ -25,6 +25,7 @@
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class XMLStreamDataReader implements DataReader<XMLStreamReader> {
     final JAXBDataReaderFactory factory;
@@ -36,15 +37,14 @@
     public Object read(XMLStreamReader input) {
         return read(null, input);
     }
-
-    public Object read(QName name, XMLStreamReader reader) {
-
-        return read(name, reader, null);
-
+    public Object read(MessagePartInfo part, XMLStreamReader reader) {
+        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(), 
+                                             factory.getSchema(), reader, part, null);
     }
 
-    public Object read(QName name, XMLStreamReader reader, Class cls) {
-        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(), factory.getSchema(), reader, name,
-                        cls, null);
+    public Object read(QName name, XMLStreamReader input, Class type) {
+        return JAXBEncoderDecoder.unmarshall(factory.getJAXBContext(), 
+                                             factory.getSchema(), input, name, type, null);
     }
+    
 }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataWriter.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataWriter.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/io/XMLStreamDataWriter.java Sun Oct 29 20:56:21 2006
@@ -19,12 +19,12 @@
 
 package org.apache.cxf.jaxb.io;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.jaxb.JAXBDataWriterFactory;
 import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> {
     final JAXBDataWriterFactory factory;
@@ -37,12 +37,12 @@
         write(obj, null, output);
     }
     
-    public void write(Object obj, QName elName, XMLStreamWriter output) {
+    public void write(Object obj, MessagePartInfo part, XMLStreamWriter output) {
         if (obj != null) {
             JAXBEncoderDecoder.marshall(factory.getJAXBContext(),
                                         factory.getSchema(),
                                         obj,
-                                        elName,
+                                        part,
                                         output,
                                         null);
         }

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/BareInInterceptorTest.java Sun Oct 29 20:56:21 2006
@@ -47,7 +47,6 @@
         assertEquals(1, parameters.size());
 
         Object obj = parameters.get(0);
-
         assertTrue(obj instanceof GreetMe);
         GreetMe greet = (GreetMe)obj;
         assertEquals("TestSOAPInputPMessage", greet.getRequestType());

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/JAXBEncoderDecoderTest.java Sun Oct 29 20:56:21 2006
@@ -48,10 +48,12 @@
 import junit.framework.TestCase;
 
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.StaxStreamFilter;
 import org.apache.cxf.testutil.common.TestUtil;
 import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.types.GreetMe;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
 import org.apache.hello_world_soap_http.types.StringStruct;
 import org.apache.type_test.doc.TypeTestPortType;
 
@@ -80,7 +82,11 @@
     protected void setUp() throws Exception {
         super.setUp();
 
-        context = JAXBEncoderDecoder.createJAXBContextForClass(Greeter.class);
+        context = JAXBContext.newInstance(new Class[] {
+            GreetMe.class,
+            GreetMeResponse.class,
+            StringStruct.class
+        });
         Method method = TestUtil.getMethod(Greeter.class, "greetMe");
         wrapperAnnotation = method.getAnnotation(RequestWrapper.class);
         
@@ -95,13 +101,17 @@
     public void testMarshallIntoDOM() throws Exception {
         String str = new String("Hello");
         QName inCorrectElName = new QName("http://test_jaxb_marshall", "requestType");
+        MessagePartInfo part = new MessagePartInfo(inCorrectElName, null);
+        part.setElement(true);
+        part.setElementQName(inCorrectElName);
+        
         SOAPFactory soapElFactory = SOAPFactory.newInstance();
         Element elNode = soapElFactory.createElement(inCorrectElName);
         assertNotNull(elNode);
 
         Node node;
         try {
-            JAXBEncoderDecoder.marshall(context, null, null, inCorrectElName,  elNode);
+            JAXBEncoderDecoder.marshall(context, null, null, part, elNode);
             fail("Should have thrown a Fault");
         } catch (Fault ex) {
             //expected - not a valid object
@@ -111,7 +121,8 @@
         obj.setRequestType("Hello");
         QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                  wrapperAnnotation.localName());
-        JAXBEncoderDecoder.marshall(context, null, obj, elName, elNode);
+        part.setElementQName(elName);
+        JAXBEncoderDecoder.marshall(context, null, obj, part, elNode);
         node = elNode.getLastChild();
         //The XML Tree Looks like
         //<GreetMe><requestType>Hello</requestType></GreetMe>
@@ -128,10 +139,10 @@
         //stringStruct.setArg0("hello");
         stringStruct.setArg1("world");
         // Marshal without the schema should work.
-        JAXBEncoderDecoder.marshall(context, null, stringStruct, elName,  elNode);
+        JAXBEncoderDecoder.marshall(context, null, stringStruct, part,  elNode);
         try {
             // Marshal with the schema should get an exception.
-            JAXBEncoderDecoder.marshall(context, schema, stringStruct, elName,  elNode);
+            JAXBEncoderDecoder.marshall(context, schema, stringStruct, part,  elNode);
             fail("Marshal with schema should have thrown a Fault");
         } catch (Fault ex) {
             //expected - not a valid object
@@ -143,7 +154,10 @@
         obj.setRequestType("Hello");
         QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                  wrapperAnnotation.localName());
-        
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+                
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         XMLOutputFactory opFactory = XMLOutputFactory.newInstance();
         opFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
@@ -151,7 +165,7 @@
 
         //STARTDOCUMENT/ENDDOCUMENT is not required
         //writer.add(eFactory.createStartDocument("utf-8", "1.0"));        
-        JAXBEncoderDecoder.marshall(context, null, obj, elName, writer);
+        JAXBEncoderDecoder.marshall(context, null, obj, part, writer);
         //writer.add(eFactory.createEndDocument());
         writer.flush();
         writer.close();
@@ -174,7 +188,8 @@
     public void testUnmarshallFromStax() throws Exception {
         QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                  wrapperAnnotation.localName());
-        
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+
         InputStream is =  getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
         XMLInputFactory factory = XMLInputFactory.newInstance();
         XMLStreamReader reader = 
@@ -186,7 +201,8 @@
 
         //Remove START_DOCUMENT & START_ELEMENT pertaining to Envelope and Body Tags.
 
-        Object val = JAXBEncoderDecoder.unmarshall(context, null, reader, elName, GreetMe.class);
+        part.setTypeClass(GreetMe.class);
+        Object val = JAXBEncoderDecoder.unmarshall(context, null, reader, part, null);
         assertNotNull(val);
         assertTrue(val instanceof GreetMe);
         assertEquals("TestSOAPInputPMessage", 
@@ -198,8 +214,12 @@
     public void testMarshalRPCLit() throws Exception {
         SOAPFactory soapElFactory = SOAPFactory.newInstance();
         QName elName = new QName("http://test_jaxb_marshall", "in");
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        
         SOAPElement elNode = soapElFactory.createElement(elName);
-        JAXBEncoderDecoder.marshall(context, null, new String("TestSOAPMessage"), elName,  elNode);
+        JAXBEncoderDecoder.marshall(context, null, new String("TestSOAPMessage"), part,  elNode);
         
         assertNotNull(elNode.getChildNodes());
         assertEquals("TestSOAPMessage", elNode.getFirstChild().getFirstChild().getNodeValue());
@@ -220,22 +240,27 @@
         QName elName = new QName(wrapperAnnotation.targetNamespace(),
                                  wrapperAnnotation.localName());
 
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        part.setTypeClass(Class.forName(wrapperAnnotation.className()));
+        
         SOAPElement elNode = getTestSOAPElement(elName);
         String str = new String("Hello Test");
         elNode.addChildElement("requestType").setValue(str);
 
-        
         Object obj = JAXBEncoderDecoder.unmarshall(context, null,
-                         elNode, elName, Class.forName(wrapperAnnotation.className()));
+                         elNode, part, null);
         assertNotNull(obj);
 
         //Add a Node and then test
         assertEquals(GreetMe.class,  obj.getClass());
         assertEquals(str, ((GreetMe)obj).getRequestType());
         
+        part.setTypeClass(String.class);
         Node n = null;
         try {
-            JAXBEncoderDecoder.unmarshall(context, null, n, null, String.class);
+            JAXBEncoderDecoder.unmarshall(context, null, n, part, null);
             fail("Should have received a Fault");
         } catch (Fault pe) {
             //Expected Exception
@@ -250,19 +275,24 @@
         // <StringStruct><arg1>World</arg1></StringStruct>
 //         elNode = soapElFactory.createElement(elName);
 //         elNode.addNamespaceDeclaration("", elName.getNamespaceURI());
+
+        part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        part.setTypeClass(Class.forName("org.apache.hello_world_soap_http.types.StringStruct"));
+        
         elNode = getTestSOAPElement(elName);
         str = new String("World");
         elNode.addChildElement("arg1").setValue(str);
         // Should unmarshal without problems when no schema used.
-        obj = JAXBEncoderDecoder.unmarshall(context, null, elNode,  elName,
-            Class.forName("org.apache.hello_world_soap_http.types.StringStruct"));
+        obj = JAXBEncoderDecoder.unmarshall(context, null, elNode, part, null);
         assertNotNull(obj);
         assertEquals(StringStruct.class,  obj.getClass());
         assertEquals(str, ((StringStruct)obj).getArg1());
+        
         try {
             // unmarshal with schema should raise exception.
-            obj = JAXBEncoderDecoder.unmarshall(context, schema, elNode,  elName,
-                Class.forName("org.apache.hello_world_soap_http.types.StringStruct"));
+            obj = JAXBEncoderDecoder.unmarshall(context, schema, elNode, part, null);
             fail("Should have thrown a Fault");
         } catch (Fault ex) {
             // expected - schema validation should fail.

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/TestBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/TestBase.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/TestBase.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/TestBase.java Sun Oct 29 20:56:21 2006
@@ -24,6 +24,7 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 
+import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -37,9 +38,7 @@
 import org.apache.cxf.binding.BindingFactoryManager;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointImpl;
-import org.apache.cxf.greeter_control.types.GreetMe;
 import org.apache.cxf.interceptor.Interceptor;
-import org.apache.cxf.interceptor.WrappedInInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
@@ -51,7 +50,8 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
-import org.apache.hello_world_soap_http.Greeter;
+import org.apache.hello_world_soap_http.types.GreetMe;
+import org.apache.hello_world_soap_http.types.GreetMeResponse;
 import org.easymock.classextension.IMocksControl;
 
 import static org.easymock.EasyMock.expect;
@@ -91,11 +91,17 @@
         service = factory.create();
         endpointInfo = service.getServiceInfo().getEndpoint(new QName(ns, "SoapPort"));
         endpoint = new EndpointImpl(bus, service, endpointInfo);
-        service.setDataBinding(new JAXBDataBinding(Greeter.class));
+        JAXBDataBinding db = new JAXBDataBinding();
+        db.setContext(JAXBContext.newInstance(new Class[] {
+            GreetMe.class,
+            GreetMeResponse.class
+        }));
+        service.setDataBinding(db);
 
         operation = endpointInfo.getBinding().getOperation(new QName(ns, "greetMe"));
-        operation.getOperationInfo().getUnwrappedOperation()
-            .getInput().setProperty(WrappedInInterceptor.WRAPPER_CLASS, GreetMe.class);
+        operation.getOperationInfo().getInput().getMessagePartByIndex(0).setTypeClass(GreetMe.class);
+        operation.getOperationInfo().getOutput()
+            .getMessagePartByIndex(0).setTypeClass(GreetMeResponse.class);
 
         message = new MessageImpl();
         Exchange exchange = new ExchangeImpl();

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataReaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataReaderTest.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataReaderTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataReaderTest.java Sun Oct 29 20:56:21 2006
@@ -31,13 +31,10 @@
 
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.jaxb.JAXBDataReaderFactory;
-import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.StaxStreamFilter;
-import org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType;
 import org.apache.hello_world_doc_lit_bare.types.TradePriceData;
-import org.apache.hello_world_rpclit.GreeterRPCLit;
 import org.apache.hello_world_rpclit.types.MyComplexStruct;
-import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.types.GreetMe;
 import org.apache.hello_world_soap_http.types.GreetMeResponse;
  
@@ -56,7 +53,7 @@
     }
 
     public void testReadWrapper() throws Exception {
-        JAXBDataReaderFactory rf = getTestReaderFactory(Greeter.class);
+        JAXBDataReaderFactory rf = getTestReaderFactory(GreetMe.class);
 
         reader = getTestReader("../resources/GreetMeDocLiteralReq.xml");
         assertNotNull(reader);
@@ -70,7 +67,7 @@
     }
 
     public void testReadWrapperReturn() throws Exception {
-        JAXBDataReaderFactory rf = getTestReaderFactory(Greeter.class);
+        JAXBDataReaderFactory rf = getTestReaderFactory(GreetMeResponse.class);
 
         reader = getTestReader("../resources/GreetMeDocLiteralResp.xml");
         assertNotNull(reader);
@@ -86,7 +83,7 @@
     }
 
     public void testReadRPC() throws Exception {
-        JAXBDataReaderFactory rf = getTestReaderFactory(GreeterRPCLit.class);
+        JAXBDataReaderFactory rf = getTestReaderFactory(MyComplexStruct.class);
 
         QName[] tags = {new QName("http://apache.org/hello_world_rpclit", "sendReceiveData")};
 
@@ -110,16 +107,19 @@
 
 
     public void testReadBare() throws Exception {
-        JAXBDataReaderFactory rf = getTestReaderFactory(PutLastTradedPricePortType.class);
+        JAXBDataReaderFactory rf = getTestReaderFactory(TradePriceData.class);
 
         reader = getTestReader("../resources/sayHiDocLitBareReq.xml");
         assertNotNull(reader);
         
         DataReader<XMLStreamReader> dr = rf.createReader(XMLStreamReader.class);
         assertNotNull(dr);
-        Object val = dr.read(new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout"),
-                             reader,
-                             null);
+        QName elName = new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout");
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        part.setTypeClass(TradePriceData.class);
+        Object val = dr.read(part, reader);
 
         assertNotNull(val);
         assertTrue(val instanceof TradePriceData);
@@ -127,8 +127,8 @@
         assertEquals(1.0f, ((TradePriceData)val).getTickerPrice());
     }
 
-    private JAXBDataReaderFactory getTestReaderFactory(Class clz) throws Exception {
-        JAXBContext ctx = JAXBEncoderDecoder.createJAXBContextForClass(clz);
+    private JAXBDataReaderFactory getTestReaderFactory(Class... clz) throws Exception {
+        JAXBContext ctx = JAXBContext.newInstance(clz);
         JAXBDataReaderFactory readerFacotry = new JAXBDataReaderFactory();
         readerFacotry.setJAXBContext(ctx);
         return readerFacotry;

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataWriterTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataWriterTest.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataWriterTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/io/XMLStreamDataWriterTest.java Sun Oct 29 20:56:21 2006
@@ -33,14 +33,11 @@
 
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.jaxb.JAXBDataWriterFactory;
-import org.apache.cxf.jaxb.JAXBEncoderDecoder;
+import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.hello_world_doc_lit_bare.PutLastTradedPricePortType;
 import org.apache.hello_world_doc_lit_bare.types.TradePriceData;
-import org.apache.hello_world_rpclit.GreeterRPCLit;
 import org.apache.hello_world_rpclit.types.MyComplexStruct;
-import org.apache.hello_world_soap_http.Greeter;
 import org.apache.hello_world_soap_http.types.GreetMe;
 import org.apache.hello_world_soap_http.types.GreetMeResponse;
 
@@ -63,7 +60,7 @@
     }
 
     public void testWriteRPCLit1() throws Exception {
-        JAXBDataWriterFactory wf = getTestWriterFactory(GreeterRPCLit.class);
+        JAXBDataWriterFactory wf = getTestWriterFactory();
         
         DataWriter<XMLStreamWriter> dw = wf.createWriter(XMLStreamWriter.class);
         assertNotNull(dw);
@@ -71,8 +68,10 @@
         String val = new String("TESTOUTPUTMESSAGE");
         QName elName = new QName("http://apache.org/hello_world_rpclit/types", 
                                  "in");
-        
-        dw.write(val, elName, streamWriter);
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        dw.write(val, part, streamWriter);
         streamWriter.flush();
 
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
@@ -88,7 +87,7 @@
     }
 
     public void testWriteRPCLit2() throws Exception {
-        JAXBDataWriterFactory wf = getTestWriterFactory(GreeterRPCLit.class);
+        JAXBDataWriterFactory wf = getTestWriterFactory(MyComplexStruct.class);
         
         DataWriter<XMLStreamWriter> dw = wf.createWriter(XMLStreamWriter.class);
         assertNotNull(dw);
@@ -100,8 +99,11 @@
         
         QName elName = new QName("http://apache.org/hello_world_rpclit/types", 
                                  "in");
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
         
-        dw.write(val, elName, streamWriter);
+        dw.write(val, part, streamWriter);
         streamWriter.flush();
 
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
@@ -122,7 +124,7 @@
     }
 
     public void testWriteBare() throws Exception {
-        JAXBDataWriterFactory wf = getTestWriterFactory(PutLastTradedPricePortType.class);
+        JAXBDataWriterFactory wf = getTestWriterFactory(TradePriceData.class);
         
         DataWriter<XMLStreamWriter> dw = wf.createWriter(XMLStreamWriter.class);
         assertNotNull(dw);
@@ -131,9 +133,11 @@
         val.setTickerSymbol("This is a symbol");
         val.setTickerPrice(1.0f);
         
-        dw.write(val,
-                 new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout"),
-                 streamWriter);
+        QName elName = new QName("http://apache.org/hello_world_doc_lit_bare/types", "inout");
+        MessagePartInfo part = new MessagePartInfo(elName, null);
+        part.setElement(true);
+        part.setElementQName(elName);
+        dw.write(val, part, streamWriter);
         streamWriter.flush();
 
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
@@ -154,7 +158,7 @@
     }
     
     public void testWriteWrapper() throws Exception {
-        JAXBDataWriterFactory wf = getTestWriterFactory(Greeter.class);
+        JAXBDataWriterFactory wf = getTestWriterFactory(GreetMe.class);
         
         DataWriter<XMLStreamWriter> dw = wf.createWriter(XMLStreamWriter.class);
         assertNotNull(dw);
@@ -183,7 +187,7 @@
     }
 
     public void testWriteWrapperReturn() throws Exception {
-        JAXBDataWriterFactory wf = getTestWriterFactory(Greeter.class);
+        JAXBDataWriterFactory wf = getTestWriterFactory(GreetMeResponse.class);
         
         DataWriter<XMLStreamWriter> dw = wf.createWriter(XMLStreamWriter.class);
         assertNotNull(dw);
@@ -211,8 +215,8 @@
         assertEquals("TESTOUTPUTMESSAGE", reader.getText());
     }
 
-    private JAXBDataWriterFactory getTestWriterFactory(Class clz) throws Exception {
-        JAXBContext ctx = JAXBEncoderDecoder.createJAXBContextForClass(clz);
+    private JAXBDataWriterFactory getTestWriterFactory(Class... clz) throws Exception {
+        JAXBContext ctx = JAXBContext.newInstance(clz);
         JAXBDataWriterFactory writerFactory = new JAXBDataWriterFactory();
         writerFactory.setJAXBContext(ctx);
         return writerFactory;

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?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- 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 Sun Oct 29 20:56:21 2006
@@ -24,7 +24,6 @@
 import java.util.concurrent.Executor;
 import java.util.logging.Logger;
 
-import javax.xml.bind.JAXBException;
 import javax.xml.transform.Source;
 import javax.xml.ws.Binding;
 import javax.xml.ws.Provider;
@@ -39,7 +38,6 @@
 import org.apache.cxf.configuration.Configurer;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerImpl;
-import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.binding.soap.JaxWsSoapBindingInfoFactoryBean;
 import org.apache.cxf.jaxws.context.WebContextResourceResolver;
 import org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder;
@@ -96,11 +94,6 @@
             serviceFactory = new ProviderServiceFactoryBean(implInfo);
         } else {
             serviceFactory = new JaxWsServiceFactoryBean(implInfo);
-            try {
-                serviceFactory.setDataBinding(new JAXBDataBinding(implInfo.getImplementorClass()));
-            } catch (JAXBException e) {
-                throw new WebServiceException("Could not create databinding.", e);
-            }
         }
         serviceFactory.setBus(bus);
         service = serviceFactory.create();

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Sun Oct 29 20:56:21 2006
@@ -81,14 +81,14 @@
     private Map<QName, PortInfo> portInfos = new HashMap<QName, PortInfo>();
     private Executor executor;
     private QName serviceName;
-    private Class<?> clazz;
+//    private Class<?> clazz;
 
     public ServiceImpl(Bus b, URL url, QName name, Class<?> cls) {
         bus = b;
         wsdlURL = url;
         this.serviceName = name;
-        clazz = cls;
-
+//        clazz = cls;
+        
         handlerResolver = new HandlerResolverImpl(bus, name);
     }
 
@@ -123,7 +123,17 @@
         }
     }
 
-    private AbstractServiceFactoryBean createDispatchService(Class<?> type) {
+    private AbstractServiceFactoryBean createDispatchService() {
+        try {
+            return createDispatchService(new JAXBDataBinding(new Class[0]));
+        } catch (JAXBException e) {
+            throw new WebServiceException("Could not create Databinding.", e);
+        }
+    }
+    private AbstractServiceFactoryBean createDispatchService(JAXBContext context) {
+        return createDispatchService(new JAXBDataBinding(context));
+    }
+    private AbstractServiceFactoryBean createDispatchService(JAXBDataBinding db) {
         AbstractServiceFactoryBean serviceFactory;
 
         Service dispatchService = null;        
@@ -131,11 +141,7 @@
         if (null != wsdlURL) {
             WSDLServiceFactory sf = new WSDLServiceFactory(bus, wsdlURL, serviceName);
             dispatchService = sf.create();            
-            try {
-                dispatchService.setDataBinding(new JAXBDataBinding(clazz));
-            } catch (JAXBException e) {
-                new WebServiceException(e);
-            }          
+            dispatchService.setDataBinding(db);
             serviceFactory = sf;
         } else {
             JaxWsServiceFactoryBean sf = new JaxWsServiceFactoryBean();
@@ -143,11 +149,7 @@
             sf.setServiceName(serviceName);
             // maybe we can find another way to create service which have no SEI
             sf.setServiceClass(DummyImpl.class);
-            try {                
-                sf.setDataBinding(new JAXBDataBinding(type));                 
-            } catch (JAXBException e) {
-                new WebServiceException(e);
-            } 
+            sf.setDataBinding(db);
             dispatchService = sf.create();
             serviceFactory = sf;
         }    
@@ -156,7 +158,7 @@
     }
 
     public <T> Dispatch<T> createDispatch(QName portName, Class<T> type, Mode mode) {
-        AbstractServiceFactoryBean sf = createDispatchService(type);
+        AbstractServiceFactoryBean sf = createDispatchService();
         Endpoint endpoint = getJaxwsEndpoint(portName, sf);
 
         Dispatch<T> disp = new DispatchImpl<T>(bus, mode, type, getExecutor(), endpoint);
@@ -168,7 +170,7 @@
 
     public Dispatch<Object> createDispatch(QName portName, JAXBContext context, Mode mode) {
 
-        AbstractServiceFactoryBean sf = createDispatchService(null);
+        AbstractServiceFactoryBean sf = createDispatchService(context);
         Endpoint endpoint = getJaxwsEndpoint(portName, sf);
         Dispatch<Object> disp = new DispatchImpl<Object>(bus, mode, context, Object.class, getExecutor(),
                                                          endpoint);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInInterceptor.java Sun Oct 29 20:56:21 2006
@@ -72,11 +72,10 @@
             } else if (message instanceof XMLMessage) {
                 DataReader<XMLMessage> dataReader = getDataReader(message, XMLMessage.class);
                 message.setContent(Object.class, 
-                                   dataReader.read(null, 
-                                                   (XMLMessage)message, type));                
+                                   dataReader.read(null, (XMLMessage)message, type));                
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new Fault(e);
         }
     }
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java Sun Oct 29 20:56:21 2006
@@ -37,6 +37,11 @@
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.FaultInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.UnwrappedOperationInfo;
 
 public class WebFaultOutInterceptor extends AbstractPhaseInterceptor<Message> {
     private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JaxWsServiceConfiguration.class);
@@ -61,8 +66,10 @@
                 DataWriterFactory writerFactory = service.getDataBinding().getDataWriterFactory();
                 DataWriter<Node> writer = writerFactory.createWriter(Node.class);
 
+                OperationInfo op = message.getExchange().get(BindingOperationInfo.class).getOperationInfo();
                 QName faultName = getFaultName(ex);
-                writer.write(faultInfo, faultName, f.getOrCreateDetail());
+                MessagePartInfo part = getFaultMessagePart(faultName, op);
+                writer.write(faultInfo, part, f.getOrCreateDetail());
 
                 f.setMessage(ex.getMessage());
             } catch (InvocationTargetException e) {
@@ -81,6 +88,29 @@
         WebFault wf = webFault.getClass().getAnnotation(WebFault.class);
 
         return new QName(wf.targetNamespace(), wf.name());
+    }
+    
+    private MessagePartInfo getFaultMessagePart(QName qname, OperationInfo op) {
+        if (op.isUnwrapped()) {
+            op = ((UnwrappedOperationInfo)op).getWrappedOperation();
+        }
+        
+        for (FaultInfo faultInfo : op.getFaults()) {
+            for (MessagePartInfo mpi : faultInfo.getMessageParts()) {
+                String ns = null;
+                if (mpi.isElement()) {
+                    ns = mpi.getElementQName().getNamespaceURI();
+                } else {
+                    ns = mpi.getTypeQName().getNamespaceURI();
+                }
+                if (qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart()) 
+                        && qname.getNamespaceURI().equals(ns)) {
+                    return mpi;
+                }
+            }
+            
+        }
+        return null;
     }
 
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassInInterceptor.java Sun Oct 29 20:56:21 2006
@@ -24,7 +24,6 @@
 
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.WrappedInInterceptor;
 import org.apache.cxf.jaxb.WrapperHelper;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -76,13 +75,12 @@
             // Sometimes, an uperation can be unwrapped according to WSDLServiceFactory,
             // but not according to JAX-WS. We should unify these at some point, but
             // for now check for the wrapper class.
-            if (boi2.getOperationInfo().getInput().getProperty(WrappedInInterceptor.WRAPPER_CLASS) 
-                == null) {
+            MessageInfo messageInfo = message.get(MessageInfo.class);
+            if (messageInfo != null && messageInfo.getMessageParts().get(0).getTypeClass() == null) {
                 return;
             }
             
             OperationInfo op = boi2.getOperationInfo();
-            MessageInfo messageInfo = message.get(MessageInfo.class);
             BindingMessageInfo bmi;
             if (messageInfo == boi.getOperationInfo().getInput()) {
                 messageInfo = op.getInput();

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WrapperClassOutInterceptor.java Sun Oct 29 20:56:21 2006
@@ -34,8 +34,6 @@
 import org.apache.cxf.service.model.OperationInfo;
 
 public class WrapperClassOutInterceptor extends AbstractPhaseInterceptor<Message> {
-    public static final String WRAPPER_CLASS = "wrapper.class";
-
     public WrapperClassOutInterceptor() {
         super();
         setPhase(Phase.PRE_LOGICAL);
@@ -44,13 +42,27 @@
     @SuppressWarnings("unchecked")
     public void handleMessage(Message message) throws Fault {
         BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+
         MessageInfo messageInfo = message.get(MessageInfo.class);
-        if (messageInfo == null) {
+        if (messageInfo == null || bop == null || !bop.isUnwrapped()) {
             return;
         }
-        Class<?> wrapped = (Class)messageInfo.getProperty(WRAPPER_CLASS);
+        
+        BindingOperationInfo newbop = bop.getWrappedOperation();
+        MessageInfo wrappedMsgInfo;
+        if (Boolean.TRUE.equals(message.get(Message.REQUESTOR_ROLE))) {
+            wrappedMsgInfo = newbop.getInput().getMessageInfo();
+        } else {
+            wrappedMsgInfo = newbop.getOutput().getMessageInfo();
+        }
+             
+        Class<?> wrapped = null;
+        List<MessagePartInfo> parts = wrappedMsgInfo.getMessageParts();
+        if (parts.size() > 0) {
+            wrapped = parts.get(0).getTypeClass();
+        }
 
-        if (bop != null && wrapped != null) {
+        if (wrapped != null) {
             List<Object> objs = message.getContent(List.class);
             
             try {
@@ -71,7 +83,6 @@
             }
             
             // we've now wrapped the object, so use the wrapped binding op
-            BindingOperationInfo newbop = bop.getWrappedOperation();
             message.getExchange().put(BindingOperationInfo.class, newbop);
             message.getExchange().put(OperationInfo.class, newbop.getOperationInfo());
             

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Sun Oct 29 20:56:21 2006
@@ -41,7 +41,7 @@
 import org.apache.cxf.service.model.EndpointInfo;
 
 /**
- * A JAX-WS specific implementation of the CXF {@link Endpoint} interface.
+ * A JAX-WS specific implementation of the CXF {@link org.apache.cxf.endpoint.Endpoint} interface.
  * Extends the interceptor provider functionality of its base class by adding 
  * interceptors in which to execute the JAX-WS handlers.
  * Creates and owns an implementation of {@link Binding} in addition to the

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Sun Oct 29 20:56:21 2006
@@ -20,12 +20,19 @@
 package org.apache.cxf.jaxws.support;
 
 import java.io.IOException;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ResourceBundle;
 
 import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebParam.Mode;
+import javax.jws.WebResult;
 import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.jws.soap.SOAPBinding.Style;
 import javax.xml.namespace.QName;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
@@ -37,6 +44,7 @@
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.resource.URIResolver;
 import org.apache.cxf.service.factory.AbstractServiceConfiguration;
+import org.apache.cxf.service.factory.DefaultServiceConfiguration;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.InterfaceInfo;
@@ -50,7 +58,7 @@
     @Override
     public void setServiceFactory(ReflectionServiceFactoryBean serviceFactory) {
         super.setServiceFactory(serviceFactory);
-        implInfo = ((JaxWsServiceFactoryBean) serviceFactory).getJaxWsImplementorInfo();        
+        implInfo = ((JaxWsServiceFactoryBean)serviceFactory).getJaxWsImplementorInfo();
     }
 
     WebService getConcreteWebServiceAttribute() {
@@ -106,10 +114,8 @@
                     throw new WebServiceException("Could not find WSDL with URL " + ws.wsdlLocation());
                 }
             } catch (IOException e) {
-                throw new ServiceConstructionException(new Message("LOAD_WSDL_EXC", 
-                                                                   BUNDLE, 
-                                                                   ws.wsdlLocation()),
-                                                       e);
+                throw new ServiceConstructionException(
+                    new Message("LOAD_WSDL_EXC", BUNDLE, ws.wsdlLocation()), e);
             }
         }
         return null;
@@ -164,16 +170,177 @@
         }
         return method;
     }
-    
+
+    @Override
+    public QName getInPartName(OperationInfo op, Method method, int paramNumber) {
+        if (paramNumber < 0) {
+            return null;
+        }
+        
+        return getPartName(op, method, paramNumber, "in");
+    }
+
+    @Override
+    public QName getInParameterName(OperationInfo op, Method method, int paramNumber) {
+        if (paramNumber < 0) {
+            return null;
+        }
+        
+        return getParameterName(op, method, paramNumber, "in");
+    }
+
+    private QName getPartName(OperationInfo op, Method method, int paramNumber, String prefix) {
+        WebParam param = getWebParam(method, paramNumber);
+        if (param != null) {
+            String tns = op.getName().getNamespaceURI();
+            String local = param.partName();
+
+            if (local.length() == 0) {
+                local = param.name();
+            }
+
+            if (local.length() == 0) {
+                getDefaultLocalName(op, method, paramNumber, prefix);
+            }
+
+            return new QName(tns, local);
+        }
+        return null;
+    }
+
+    private QName getParameterName(OperationInfo op, Method method, int paramNumber, String prefix) {
+        WebParam param = getWebParam(method, paramNumber);
+        if (param != null) {
+            String tns = param.targetNamespace();
+            String local = param.name();
+
+            if (tns.length() == 0) {
+                tns = op.getName().getNamespaceURI();
+            }
+
+            if (local.length() == 0) {
+                local = getDefaultLocalName(op, method, paramNumber, prefix);
+            }
+
+            return new QName(tns, local);
+        }
+        return null;
+    }
+
+    private String getDefaultLocalName(OperationInfo op, Method method, int paramNumber, String prefix) {
+        Class<?> impl = implInfo.getImplementorClass(); 
+        // try to grab the implementation class so we can read the debug symbols from it
+        if (impl == null) {
+            try {
+                method = impl.getMethod(method.getName(), method.getParameterTypes());
+            } catch (Exception e) {
+                throw new ServiceConstructionException(e);
+            }
+        }
+        
+        return DefaultServiceConfiguration.createName(method, paramNumber, op.getInput()
+            .getMessageParts().size(), false, prefix);
+    }
+
+    private WebParam getWebParam(Method method, int parameter) {
+        Annotation[][] annotations = method.getParameterAnnotations();
+        if (parameter >= annotations.length) {
+            return null;
+        } else {
+            for (int i = 0; i < annotations[parameter].length; i++) {
+                Annotation annotation = annotations[parameter][i];
+                if (annotation.annotationType().equals(WebParam.class)) {
+                    return (WebParam)annotation;
+                }
+            }
+            return null;
+        }
+    }
+
+    @Override
+    public QName getOutParameterName(OperationInfo op, Method method, int paramNumber) {
+        if (paramNumber >= 0) {
+            return getParameterName(op, method, paramNumber, "out");
+        } else {
+            WebResult webResult = getWebResult(method);
+
+            if (webResult != null) {
+                String tns = webResult.targetNamespace();
+                String local = webResult.name();
+
+                if (tns.length() == 0) {
+                    tns = op.getName().getNamespaceURI();
+                }
+
+                if (local.length() == 0) {
+                    local = getDefaultLocalName(op, method, paramNumber, "out");
+                }
+
+                return new QName(tns, local);
+            }
+        }
+        return super.getOutParameterName(op, method, paramNumber);
+    }
+
+    @Override
+    public QName getOutPartName(OperationInfo op, Method method, int paramNumber) {
+        if (paramNumber >= 0) {
+            return getPartName(op, method, paramNumber, "out");
+        } else {
+            WebResult webResult = getWebResult(method);
+
+            if (webResult != null) {
+                String tns = op.getName().getNamespaceURI();
+                String local = webResult.partName();
+
+                if (local.length() == 0) {
+                    local = webResult.name();
+                }
+
+                if (local.length() == 0) {
+                    local = getDefaultLocalName(op, method, paramNumber, "out");
+                }
+                return new QName(tns, local);
+            }
+        }
+        return super.getOutPartName(op, method, paramNumber);
+    }
+
+    @Override
+    public Boolean isInParam(Method method, int j) {
+        if (j < 0) {
+            return Boolean.FALSE;
+        }
+            
+        WebParam webParam = getWebParam(method, j);
+
+        return webParam == null || (webParam.mode().equals(Mode.IN) || webParam.mode().equals(Mode.INOUT));
+    }
+
+    private WebResult getWebResult(Method method) {
+        return method.getAnnotation(WebResult.class);
+    }
+
+    @Override
+    public Boolean isOutParam(Method method, int j) {
+        if (j == -1) {
+            return !method.getReturnType().equals(void.class);
+        }
+
+        WebParam webParam = getWebParam(method, j);
+
+        return webParam != null && (webParam.mode().equals(Mode.OUT) || webParam.mode().equals(Mode.INOUT));
+    }
+
     @Override
     public Class getResponseWrapper(Method selected) {
         Method m = getDeclaredMethod(selected);
-        
+
         ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
         if (rw == null) {
             return null;
         }
-        
+
         String clsName = rw.className();
         if (clsName.length() > 0) {
             try {
@@ -182,19 +349,19 @@
                 throw new ServiceConstructionException(e);
             }
         }
-        
+
         return null;
     }
 
     @Override
     public Class getRequestWrapper(Method selected) {
         Method m = getDeclaredMethod(selected);
-        
+
         RequestWrapper rw = m.getAnnotation(RequestWrapper.class);
         if (rw == null) {
             return null;
         }
-        
+
         String clsName = rw.className();
 
         if (clsName.length() > 0) {
@@ -204,7 +371,7 @@
                 throw new ServiceConstructionException(e);
             }
         }
-        
+
         return null;
     }
 
@@ -220,10 +387,30 @@
             if (ns.length() == 0) {
                 ns = service.getName().getNamespaceURI();
             }
-            
+
             return new QName(ns, name);
         }
         return null;
     }
-    
+
+    @Override
+    public Boolean isWrapped(Method m) {
+        // see if someone overrode the default value
+        if (!getServiceFactory().isWrapped()) {
+            return Boolean.FALSE;
+        }
+
+        SOAPBinding ann = m.getAnnotation(SOAPBinding.class);
+        if (ann != null) {
+            return !(ann.parameterStyle().equals(ParameterStyle.BARE) || ann.style().equals(Style.RPC));
+        }
+
+        ann = implInfo.getEndpointClass().getAnnotation(SOAPBinding.class);
+        if (ann != null) {
+            return !(ann.parameterStyle().equals(ParameterStyle.BARE) || ann.style().equals(Style.RPC));
+        }
+
+        return null;
+    }
+
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Sun Oct 29 20:56:21 2006
@@ -23,12 +23,12 @@
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
 import javax.wsdl.Operation;
-import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Holder;
@@ -36,14 +36,12 @@
 
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
-import org.apache.cxf.interceptor.WrappedInInterceptor;
-import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor;
-import org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.FaultInfo;
 import org.apache.cxf.service.model.InterfaceInfo;
+import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.wsdl11.WSDLServiceBuilder;
@@ -56,8 +54,6 @@
 
     public static final String HOLDER = "messagepart.isholder";
 
-    private JAXBDataBinding dataBinding;
-
     private JaxWsServiceConfiguration jaxWsConfiguration;
 
     public JaxWsServiceFactoryBean() {
@@ -131,41 +127,13 @@
     void initializeWrapping(OperationInfo o, Method selected) {
         Class responseWrapper = getResponseWrapper(selected);
         if (responseWrapper != null) {
-            o.getUnwrappedOperation().getOutput().setProperty(WrapperClassOutInterceptor.WRAPPER_CLASS,
-                    responseWrapper);
+            o.getOutput().getMessageParts().get(0).setTypeClass(responseWrapper);
         }
         Class<?> requestWrapper = getRequestWrapper(selected);
         if (requestWrapper != null) {
-            o.getUnwrappedOperation().getInput().setProperty(WrappedInInterceptor.WRAPPER_CLASS,
-                    requestWrapper);
+            o.getInput().getMessageParts().get(0).setTypeClass(requestWrapper);
         }
     }
-
-    @Override
-    protected void initializeDataBindings() {
-        try {
-            dataBinding = new JAXBDataBinding(getJaxWsImplementorInfo().getEndpointClass());
-        } catch (JAXBException e) {
-            throw new ServiceConstructionException(e);
-        }
-
-        setDataBinding(dataBinding);
-
-        super.initializeDataBindings();
-    }
-
-    
-    private void setInputClassInfo(OperationInfo o, Method selected) {
-        Object[] para = selected.getParameterTypes();
-        int inIdx = 0;
-        for (MessagePartInfo mpiIn : o.getInput().getMessageParts()) {
-            // check for sayHi() type no input param method
-            if (para.length > 0 && !para[inIdx].equals(Holder.class)) {
-                mpiIn.setProperty(Class.class.getName(), para[inIdx]);
-            }
-            inIdx++;
-        }        
-    }
     
     private void setFaultClassInfo(OperationInfo o, Method selected) {
         Class[] types = selected.getExceptionTypes();
@@ -189,7 +157,7 @@
                             Method method = beanClass.getMethod("getFaultInfo", new Class[0]);
                             Class sub = method.getReturnType();
                             fi.setProperty(Class.class.getName(), exClass);
-                            mpi.setProperty(Class.class.getName(), sub);
+                            mpi.setTypeClass(sub);
                         } catch (NoSuchMethodException nsme) {
                             nsme.printStackTrace();
                         }
@@ -204,95 +172,96 @@
      * @param o
      * @param method
      */
-    protected void initalizeClassInfo(OperationInfo o, Method selected, List<String> paramOrder) {
-        setInputClassInfo(o, selected);
-        if (o.getOutput() == null) {
-            return;
-        }
-        int outPartCount = o.getOutput().getMessageParts().size();
-        int inPartCount = o.getInput().getMessageParts().size();        
-        int outIdx = 0;
-        int offset = 0;
-        for (MessagePartInfo mpiOut : o.getOutput().getMessageParts()) {
-            int inIdx = 0;
-            boolean isInOut = false;
-            MessagePartInfo mpiInHolder = null;
-            Object[] paraType = selected.getGenericParameterTypes();
-            for (MessagePartInfo mpiIn : o.getInput().getMessageParts()) {
-                if (mpiOut.getName().equals(mpiIn.getName())) {
-                    if (mpiOut.isElement() && mpiIn.isElement()
-                            && mpiOut.getElementQName().equals(mpiIn.getElementQName())) {
-                        isInOut = true;
-                        mpiInHolder = mpiIn;
-                    } else if (!mpiOut.isElement() && !mpiIn.isElement()
-                            && mpiOut.getTypeQName().equals(mpiIn.getTypeQName())) {
-                        isInOut = true;
-                        mpiInHolder = mpiIn;
-                    }
-                }
-                if (isInOut) {
-                    ParameterizedType paramType = (ParameterizedType) paraType[inIdx];
-                    Class rawClass = getHolderClass(paramType, inIdx);
-                    mpiOut.setProperty(Class.class.getName(), rawClass);
-                    mpiInHolder.setProperty(Class.class.getName(), rawClass);
-                    mpiOut.setProperty(JaxWsServiceFactoryBean.MODE_INOUT, Boolean.TRUE);
-                    mpiInHolder.setProperty(JaxWsServiceFactoryBean.MODE_INOUT, Boolean.TRUE);
-                    offset++;
-                    break;
-                }
-                inIdx++;
+    protected void initalizeClassInfo(OperationInfo o, Method method, List<String> paramOrder) {
+        if (isWrapped(method)) {
+            if (o.hasInput()) {
+                MessageInfo input = o.getInput();
+                MessagePartInfo part = input.getMessageParts().get(0);
+                part.setTypeClass(getRequestWrapper(method));
             }
-            if (!isInOut) {
-                if (((Class) selected.getReturnType()).getName().equals("void")) {
-                    // to avoid <element name="..."><complexType/></element> in
-                    // output message part
-                    if (paraType.length > inPartCount + outIdx 
-                            && paraType[inPartCount + outIdx] instanceof ParameterizedType) {
-                        ParameterizedType paramType = (ParameterizedType) paraType[inPartCount + outIdx];
-                        Class rawClass = getHolderClass(paramType, inPartCount + outIdx);
-                        mpiOut.setProperty(Class.class.getName(), rawClass);
-                        mpiOut.setProperty(JaxWsServiceFactoryBean.MODE_OUT, Boolean.TRUE);
-                    }
-                } else {
-                    String local = mpiOut.isElement() ? mpiOut.getElementQName().getLocalPart() : mpiOut
-                            .getTypeQName().getLocalPart();
-                    if ("return".equalsIgnoreCase(mpiOut.getName().getLocalPart()) || outPartCount == 1) {
-                        mpiOut.setProperty(Class.class.getName(), selected.getReturnType());
-                        offset++;
-                    } else {
-                        if (paramOrder != null && !paramOrder.contains(local)) {
-                            int idx = inPartCount + outIdx - offset;
-                            ParameterizedType paramType = (ParameterizedType) paraType[idx];
-                            Class rawClass = getHolderClass(paramType, idx);
-                            mpiOut.setProperty(Class.class.getName(), rawClass);
-                            mpiOut.setProperty(JaxWsServiceFactoryBean.MODE_OUT, Boolean.TRUE);
-                        }
-                    }
-                }
-            }            
-            outIdx++;
+            
+            if (o.hasOutput()) {
+                MessageInfo input = o.getOutput();
+                MessagePartInfo part = input.getMessageParts().get(0);
+                part.setTypeClass(getResponseWrapper(method));
+            }
+            
+            setFaultClassInfo(o, method);
+            o = o.getUnwrappedOperation();
+        } else if (o.isUnwrappedCapable()) {
+            // remove the unrwrapped operation because it will break the
+            // the WrapperClassOutInterceptor, and in general makes
+            // life more confusing
+            o.setUnwrappedOperation(null);
+         
+            setFaultClassInfo(o, method);
+        }
+        
+        // Initialize return type
+        Class<?>[] paramTypes = method.getParameterTypes(); 
+        Type[] genericTypes = method.getGenericParameterTypes();
+        for (int i = 0; i < paramTypes.length; i++) {
+            Class paramType = paramTypes[i];
+            Type genericType = genericTypes[i];
+            
+            initializeParameter(o, method, i, paramType, genericType);
         }
-        setFaultClassInfo(o, selected);
+        
+        Class paramType = method.getReturnType();
+        Type genericType = method.getGenericReturnType();
+        
+        initializeParameter(o, method, -1, paramType, genericType);
+
+        setFaultClassInfo(o, method);
+    }
+
+    private void initializeParameter(OperationInfo o, Method method, int i, 
+                                     Class paramType, Type genericType) {
+        boolean isIn = isInParam(method, i);
+        boolean isOut = isOutParam(method, i);
+        
+        if (isIn && !isOut) {
+            QName name = getInPartName(o, method, i);
+            MessagePartInfo part = o.getInput().getMessagePart(name);
+            initializeParameter(part, paramType, genericType, i);
+        } else if (!isIn && isOut) {
+            QName name = getOutPartName(o, method, i);
+            MessagePartInfo part = o.getOutput().getMessagePart(name);
+            initializeParameter(part, paramType, genericType, i);
+        } else if (isIn && isOut) {
+            QName name = getOutPartName(o, method, i);
+            MessagePartInfo part = o.getInput().getMessagePart(name);
+            part.setProperty(JaxWsServiceFactoryBean.MODE_INOUT, Boolean.TRUE);
+            initializeParameter(part, paramType, genericType, i);
+            
+            part = o.getOutput().getMessagePart(name);
+            part.setProperty(JaxWsServiceFactoryBean.MODE_INOUT, Boolean.TRUE);
+            initializeParameter(part, paramType, genericType, i);
+        }
+    }
+
+    private void initializeParameter(MessagePartInfo part, Class rawClass, Type type, int i) {
+        if (rawClass.equals(Holder.class) && type instanceof ParameterizedType) {
+            ParameterizedType paramType = (ParameterizedType)type;
+            rawClass = getHolderClass(paramType, i);
+        }
+        part.setProperty(GENERIC_TYPE, type);
+        part.setTypeClass(rawClass);
     }
 
     private static Class getHolderClass(ParameterizedType paramType, int idx) {
-        if (((Class) paramType.getRawType()).getName().equals("javax.xml.ws.Holder")) {
-            Object rawType = paramType.getActualTypeArguments()[0];
-            Class rawClass;
-            if (rawType instanceof GenericArrayType) {
-                rawClass = (Class) ((GenericArrayType) rawType).getGenericComponentType();
-                rawClass = Array.newInstance(rawClass, 0).getClass();
-            } else {
-                if (rawType instanceof ParameterizedType) {
-                    rawType = (Class) ((ParameterizedType) rawType).getRawType();
-                }
-                rawClass = (Class) rawType;
-            }
-            return rawClass;
+        Object rawType = paramType.getActualTypeArguments()[0];
+        Class rawClass;
+        if (rawType instanceof GenericArrayType) {
+            rawClass = (Class) ((GenericArrayType) rawType).getGenericComponentType();
+            rawClass = Array.newInstance(rawClass, 0).getClass();
         } else {
-            throw new RuntimeException("Expected Holder at " + idx + " parametor of input message");
+            if (rawType instanceof ParameterizedType) {
+                rawType = (Class) ((ParameterizedType) rawType).getRawType();
+            }
+            rawClass = (Class) rawType;
         }
-
+        return rawClass;
     }
 
     public void setJaxWsConfiguration(JaxWsServiceConfiguration jaxWsConfiguration) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ProviderServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ProviderServiceFactoryBean.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ProviderServiceFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ProviderServiceFactoryBean.java Sun Oct 29 20:56:21 2006
@@ -22,11 +22,9 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
-import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.binding.xml.XMLConstants;
-import org.apache.cxf.databinding.DataBinding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.jaxb.JAXBDataBinding;
@@ -61,8 +59,6 @@
         try {
             Method invoke = getServiceClass().getMethod("invoke", c);
             
-            
-            
             // Bind each operation to the invoke method.
             for (OperationInfo o : getService().getServiceInfo().getInterface().getOperations()) {
                 getMethodDispatcher().bind(o, invoke);
@@ -141,12 +137,7 @@
 
     @Override
     protected void initializeDataBindings() {   
-        try {
-            DataBinding dataBinding = new JAXBDataBinding(getServiceClass());
-            setDataBinding(dataBinding);
-        } catch (JAXBException e) {
-            throw new ServiceConstructionException(e);
-        }
+        setDataBinding(new JAXBDataBinding());
         
         super.initializeDataBindings();
     }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java Sun Oct 29 20:56:21 2006
@@ -27,7 +27,6 @@
 import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.service.Service;
@@ -42,9 +41,8 @@
     
     public void testDocLitModel() throws Exception {
         Definition d = createService(false);
-        
+
         Document wsdl = WSDLFactory.newInstance().newWSDLWriter().getDocument(d);
-        
         addNamespace("svc", "http://service.jaxws.cxf.apache.org");
         
         assertValid("/wsdl:definitions/wsdl:service[@name='Hello']", wsdl);
@@ -83,12 +81,11 @@
         bean.setBus(bus);
         bean.setServiceClass(Hello.class);
         bean.setWrapped(wrapped);
-        bean.setDataBinding(new JAXBDataBinding(Hello.class));
         
         Service service = bean.create();
 
         InterfaceInfo i = service.getServiceInfo().getInterface();
-        assertEquals(1, i.getOperations().size());
+        assertEquals(2, i.getOperations().size());
 
         ServerFactoryBean svrFactory = new ServerFactoryBean();
         svrFactory.setBus(bus);
@@ -118,5 +115,14 @@
 
         addNamespace("h", "http://service.jaxws.cxf.apache.org");
         assertValid("//s:Body/h:sayHiResponse/h:out", res);
+        
+        res = invoke("http://localhost:9090/hello", 
+                     LocalTransportFactory.TRANSPORT_ID,
+                     "getGreetings.xml");
+
+        assertNotNull(res);
+
+        addNamespace("h", "http://service.jaxws.cxf.apache.org");
+        assertValid("//s:Body/h:getGreetingsResponse/h:out/item", res);
     }
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java?view=diff&rev=469066&r1=469065&r2=469066
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java Sun Oct 29 20:56:21 2006
@@ -18,13 +18,21 @@
  */
 package org.apache.cxf.jaxws;
 
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
 import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.ServerFactoryBean;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.transport.local.LocalTransportFactory;
 import org.apache.header_test.TestHeaderImpl;
+import org.apache.header_test.types.TestHeader5;
 
 public class HeaderTest extends AbstractJaxWsTest {
     public void testInvocation() throws Exception {
@@ -34,7 +42,27 @@
         bean.setBus(bus);
         bean.setServiceClass(TestHeaderImpl.class);
         
-        bean.create();
+        Service service = bean.create();
+        
+        OperationInfo op = service.getServiceInfo().getInterface().getOperation(
+            new QName(service.getName().getNamespaceURI(), "testHeader5"));
+        assertNotNull(op);
+        List<MessagePartInfo> parts = op.getInput().getMessageParts();
+        assertEquals(1, parts.size());
+        
+        MessagePartInfo part = parts.get(0);
+        assertNotNull(part.getTypeClass());
+        assertEquals(TestHeader5.class, part.getTypeClass());
+        
+        parts = op.getOutput().getMessageParts();
+        assertEquals(1, parts.size());
+        
+        part = parts.get(0);
+        assertNotNull(part.getTypeClass());
+        assertEquals(TestHeader5.class, part.getTypeClass());
+          
+//        part = parts.get(1);
+//        assertNotNull(part.getTypeClass());
         
         ServerFactoryBean svr = new ServerFactoryBean();
         svr.setBus(bus);



Mime
View raw message