cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r774058 [1/2] - in /cxf/trunk: rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/ rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/ rt/core/src/main/java/org/apache/cxf/attachment/ rt/core/src/main/java/org/apache/cxf/bindi...
Date Tue, 12 May 2009 20:08:52 GMT
Author: dkulp
Date: Tue May 12 20:08:51 2009
New Revision: 774058

URL: http://svn.apache.org/viewvc?rev=774058&view=rev
Log:
[CXF-1907] Update to get the provider stuff refactored to go through the normal interceptor chains.
Dispatch/Providers now should be able to participate in ws-addressing/security/rm.

Added:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java   (with props)
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java   (with props)
Removed:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/AsyncResponse.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchAsyncCallable.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/DispatchLogicalHandlerInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/DispatchSOAPHandlerInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchOutDatabindingInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/interceptors/
Modified:
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/ProviderRPCClientServerTest.java
    cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/datasource/DataSourceProviderTest.java

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Tue May 12 20:08:51 2009
@@ -355,47 +355,44 @@
         sb.getOutFaultInterceptors().add(new StaxOutInterceptor());
         sb.getOutFaultInterceptors().add(new SoapOutInterceptor(getBus()));
 
-        //Do not add any interceptors if it is Provider/Dispatch
-        if (!Boolean.TRUE.equals(binding.getProperty(DATABINDING_DISABLED))) {
-            sb.getInInterceptors().add(new AttachmentInInterceptor());
-            sb.getInInterceptors().add(new StaxInInterceptor());
-            sb.getInInterceptors().add(new SoapActionInInterceptor());
-            
-            sb.getOutInterceptors().add(new AttachmentOutInterceptor());
-            sb.getOutInterceptors().add(new StaxOutInterceptor());
-            sb.getOutInterceptors().add(new SoapHeaderOutFilterInterceptor());
-
-            if (SoapBindingConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
-                sb.getInInterceptors().add(new RPCInInterceptor());
-                sb.getOutInterceptors().add(new RPCOutInterceptor());
-            } else if (SoapBindingConstants.BINDING_STYLE_DOC.equalsIgnoreCase(bindingStyle)
-                            && SoapBindingConstants.PARAMETER_STYLE_BARE.equalsIgnoreCase(parameterStyle)) {
-                //sb.getInInterceptors().add(new BareInInterceptor());
-                sb.getInInterceptors().add(new DocLiteralInInterceptor());
-                if (hasWrapped) {
-                    sb.getOutInterceptors().add(new WrappedOutInterceptor());                    
-                }
-                sb.getOutInterceptors().add(new BareOutInterceptor());
-            } else {
-                //sb.getInInterceptors().add(new WrappedInInterceptor());
-                sb.getInInterceptors().add(new DocLiteralInInterceptor());
-                sb.getOutInterceptors().add(new WrappedOutInterceptor());
-                sb.getOutInterceptors().add(new BareOutInterceptor());
-            }
-            sb.getInInterceptors().add(new SoapHeaderInterceptor());
-
-            sb.getInInterceptors().add(new ReadHeadersInterceptor(getBus()));
-            sb.getInInterceptors().add(new CheckFaultInterceptor());
-            sb.getInInterceptors().add(new MustUnderstandInterceptor());
-            sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
-            sb.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
-            sb.getOutFaultInterceptors().add(new SoapOutInterceptor(getBus()));
-
-            // REVISIT: The phase interceptor chain seems to freak out if this added
-            // first. Not sure what the deal is at the moment, I suspect the
-            // ordering algorithm needs to be improved
-            sb.getInInterceptors().add(new URIMappingInterceptor());
-        }
+        sb.getInInterceptors().add(new AttachmentInInterceptor());
+        sb.getInInterceptors().add(new StaxInInterceptor());
+        sb.getInInterceptors().add(new SoapActionInInterceptor());
+        
+        sb.getOutInterceptors().add(new AttachmentOutInterceptor());
+        sb.getOutInterceptors().add(new StaxOutInterceptor());
+        sb.getOutInterceptors().add(new SoapHeaderOutFilterInterceptor());
+
+        if (SoapBindingConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
+            sb.getInInterceptors().add(new RPCInInterceptor());
+            sb.getOutInterceptors().add(new RPCOutInterceptor());
+        } else if (SoapBindingConstants.BINDING_STYLE_DOC.equalsIgnoreCase(bindingStyle)
+                        && SoapBindingConstants.PARAMETER_STYLE_BARE.equalsIgnoreCase(parameterStyle)) {
+            //sb.getInInterceptors().add(new BareInInterceptor());
+            sb.getInInterceptors().add(new DocLiteralInInterceptor());
+            if (hasWrapped) {
+                sb.getOutInterceptors().add(new WrappedOutInterceptor());                    
+            }
+            sb.getOutInterceptors().add(new BareOutInterceptor());
+        } else {
+            //sb.getInInterceptors().add(new WrappedInInterceptor());
+            sb.getInInterceptors().add(new DocLiteralInInterceptor());
+            sb.getOutInterceptors().add(new WrappedOutInterceptor());
+            sb.getOutInterceptors().add(new BareOutInterceptor());
+        }
+        sb.getInInterceptors().add(new SoapHeaderInterceptor());
+
+        sb.getInInterceptors().add(new ReadHeadersInterceptor(getBus()));
+        sb.getInInterceptors().add(new CheckFaultInterceptor());
+        sb.getInInterceptors().add(new MustUnderstandInterceptor());
+        sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
+        sb.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
+        sb.getOutFaultInterceptors().add(new SoapOutInterceptor(getBus()));
+
+        // REVISIT: The phase interceptor chain seems to freak out if this added
+        // first. Not sure what the deal is at the moment, I suspect the
+        // ordering algorithm needs to be improved
+        sb.getInInterceptors().add(new URIMappingInterceptor());
 
         if (version.getVersion() == 1.1) {
             sb.getInFaultInterceptors().add(new Soap11FaultInInterceptor());

Modified: cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java (original)
+++ cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java Tue May 12 20:08:51 2009
@@ -27,6 +27,7 @@
 import org.apache.cxf.binding.xml.interceptor.XMLMessageInInterceptor;
 import org.apache.cxf.binding.xml.interceptor.XMLMessageOutInterceptor;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
+import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.DocLiteralInInterceptor;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.interceptor.StaxOutInterceptor;
@@ -42,17 +43,16 @@
     public Binding createBinding(BindingInfo binding) {
         XMLBinding xb = new XMLBinding(binding);
         
-        if (!Boolean.TRUE.equals(binding.getProperty(DATABINDING_DISABLED))) {
-            xb.getInInterceptors().add(new AttachmentInInterceptor());    
-            xb.getInInterceptors().add(new StaxInInterceptor());
-            xb.getInInterceptors().add(new URIMappingInterceptor());
-            xb.getInInterceptors().add(new DocLiteralInInterceptor());
-            xb.getInInterceptors().add(new XMLMessageInInterceptor());
-
-            xb.getOutInterceptors().add(new StaxOutInterceptor());
-            xb.getOutInterceptors().add(new WrappedOutInterceptor());
-            xb.getOutInterceptors().add(new XMLMessageOutInterceptor());            
-        }        
+        xb.getInInterceptors().add(new AttachmentInInterceptor());    
+        xb.getInInterceptors().add(new StaxInInterceptor());
+        xb.getInInterceptors().add(new URIMappingInterceptor());
+        xb.getInInterceptors().add(new DocLiteralInInterceptor());
+        xb.getInInterceptors().add(new XMLMessageInInterceptor());
+        
+        xb.getOutInterceptors().add(new AttachmentOutInterceptor());
+        xb.getOutInterceptors().add(new StaxOutInterceptor());
+        xb.getOutInterceptors().add(new WrappedOutInterceptor());
+        xb.getOutInterceptors().add(new XMLMessageOutInterceptor());            
 
         xb.getInFaultInterceptors().add(new XMLFaultInInterceptor());
         xb.getOutFaultInterceptors().add(new StaxOutInterceptor());

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/LazyAttachmentCollection.java Tue May 12 20:08:51 2009
@@ -122,6 +122,9 @@
     }
 
     public boolean isEmpty() {
+        if (attachments.isEmpty()) {
+            return !iterator().hasNext();
+        }
         return attachments.isEmpty();
     }
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java Tue May 12 20:08:51 2009
@@ -47,8 +47,6 @@
 
 public abstract class AbstractBindingFactory implements BindingFactory, WSDLBindingFactory {
 
-    public static final String DATABINDING_DISABLED = "databinding.disabled";
-
     protected Collection<String> activationNamespaces;
 
     protected Bus bus;

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java Tue May 12 20:08:51 2009
@@ -19,9 +19,12 @@
 package org.apache.cxf.databinding.source;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.Collection;
 import java.util.logging.Logger;
 
+import javax.activation.DataSource;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -52,19 +55,11 @@
         return read(null, input, part.getTypeClass());
     }
 
-    public Object read(QName name, XMLStreamReader input, Class type) {
+    public Object read(final QName name, XMLStreamReader input, Class type) {
         if (type != null) {
             if (SAXSource.class.isAssignableFrom(type)) {
                 try {
-                    CachedOutputStream out = new CachedOutputStream();
-                    try {
-                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
-                        StaxUtils.copy(input, xsw);
-                        xsw.close();
-                        return new SAXSource(new InputSource(out.getInputStream()));
-                    } finally {
-                        out.close();
-                    }
+                    return new SAXSource(new InputSource(getInputStream(input)));
                 } catch (IOException e) {
                     throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                 } catch (XMLStreamException e) {
@@ -72,25 +67,51 @@
                 }
             } else if (StreamSource.class.isAssignableFrom(type)) {
                 try {
-                    CachedOutputStream out = new CachedOutputStream();
-                    try {
-                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
-                        StaxUtils.copy(input, xsw);
-                        xsw.close();
-                        return new StreamSource(out.getInputStream());
-                    } finally {
-                        out.close();
-                    }
+                    return new StreamSource(getInputStream(input));
                 } catch (IOException e) {
                     throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                 } catch (XMLStreamException e) {
                     throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
                 }
-            } 
+            } else if (DataSource.class.isAssignableFrom(type)) {
+                try {
+                    final InputStream ins = getInputStream(input);
+                    return new DataSource() {
+                        public String getContentType() {
+                            return "text/xml";
+                        }
+                        public InputStream getInputStream() throws IOException {
+                            return ins;
+                        }
+                        public String getName() {
+                            return name.toString();
+                        }
+                        public OutputStream getOutputStream() throws IOException {
+                            return null;
+                        }
+                    };
+                } catch (IOException e) {
+                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+                } catch (XMLStreamException e) {
+                    throw new Fault(new Message("COULD_NOT_READ_XML_STREAM", LOG), e);
+                }                
+            }
         }
         return read(input);
     }
-
+    private InputStream getInputStream(XMLStreamReader input) 
+        throws XMLStreamException, IOException {
+        
+        CachedOutputStream out = new CachedOutputStream();
+        try {
+            XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
+            StaxUtils.copy(input, xsw);
+            xsw.close();
+            return out.getInputStream();
+        } finally {
+            out.close();
+        }
+    }
     public Object read(XMLStreamReader reader) {
         // Use a DOMSource for now, we should really use a StaxSource/SAXSource though for 
         // performance reasons

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java Tue May 12 20:08:51 2009
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.interceptor;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.ResourceBundle;
@@ -39,15 +41,18 @@
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
 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.service.model.ServiceInfo;
 import org.apache.cxf.service.model.ServiceModelUtil;
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 public abstract class AbstractInDatabindingInterceptor extends AbstractPhaseInterceptor<Message> {
-
+    public static final String NO_VALIDATE_PARTS = AbstractInDatabindingInterceptor.class.getName() 
+                                                    + ".novalidate-parts";
     private static final QName XSD_ANY = new QName("http://www.w3.org/2001/XMLSchema", "anyType", "xsd");
 
     private static final ResourceBundle BUNDLE = BundleUtils
@@ -136,17 +141,19 @@
      * @return
      */
     protected MessagePartInfo findMessagePart(Exchange exchange, Collection<OperationInfo> operations,
-                                              QName name, boolean client, int index) {
+                                              QName name, boolean client, int index,
+                                              Message message) {
         Endpoint ep = exchange.get(Endpoint.class);
         MessagePartInfo lastChoice = null;
+        BindingMessageInfo msgInfo = null;
+        BindingOperationInfo boi = null;
         for (Iterator<OperationInfo> itr = operations.iterator(); itr.hasNext();) {
             OperationInfo op = itr.next();
 
-            BindingOperationInfo boi = ep.getEndpointInfo().getBinding().getOperation(op);
+            boi = ep.getEndpointInfo().getBinding().getOperation(op);
             if (boi == null) {
                 continue;
             }
-            BindingMessageInfo msgInfo = null;
             if (client) {
                 msgInfo = boi.getOutput();
             } else {
@@ -182,9 +189,49 @@
                 itr.remove();
             }
         }
+        if (lastChoice != null) {
+            setMessage(message, boi, client, boi.getBinding().getService(), msgInfo.getMessageInfo());
+        }
         return lastChoice;
     }    
+    protected MessageInfo setMessage(Message message, BindingOperationInfo operation,
+                                   boolean requestor, ServiceInfo si,
+                                   MessageInfo msgInfo) {
+        message.put(MessageInfo.class, msgInfo);
+
+        Exchange ex = message.getExchange();
+        ex.put(BindingOperationInfo.class, operation);
+        ex.put(OperationInfo.class, operation.getOperationInfo());
+        ex.setOneWay(operation.getOperationInfo().isOneWay());
+
+        //Set standard MessageContext properties required by JAX_WS, but not specific to JAX_WS.
+        message.put(Message.WSDL_OPERATION, operation.getName());
+
+        QName serviceQName = si.getName();
+        message.put(Message.WSDL_SERVICE, serviceQName);
+
+        QName interfaceQName = si.getInterface().getName();
+        message.put(Message.WSDL_INTERFACE, interfaceQName);
+
+        EndpointInfo endpointInfo = ex.get(Endpoint.class).getEndpointInfo();
+        QName portQName = endpointInfo.getName();
+        message.put(Message.WSDL_PORT, portQName);
+
+        
+        URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
+        if (wsdlDescription == null) {
+            String address = endpointInfo.getAddress();
+            try {
+                wsdlDescription = new URI(address + "?wsdl");
+            } catch (URISyntaxException e) {
+                //do nothing
+            }
+            endpointInfo.setProperty("URI", wsdlDescription);
+        }
+        message.put(Message.WSDL_DESCRIPTION, wsdlDescription);
 
+        return msgInfo;
+    }
     /**
      * Returns a BindingOperationInfo if the operation is indentified as 
      * a wrapped method,  return null if it is not a wrapped method 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/BareInInterceptor.java Tue May 12 20:08:51 2009
@@ -126,7 +126,7 @@
                 assert msgInfo.getMessageParts().size() > paramNum;
                 p = msgInfo.getMessageParts().get(paramNum);
             } else {
-                p = findMessagePart(exchange, ops, elName, client, paramNum);
+                p = findMessagePart(exchange, ops, elName, client, paramNum, message);
             }
 
             if (p == null) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java Tue May 12 20:08:51 2009
@@ -19,8 +19,6 @@
 
 package org.apache.cxf.interceptor;
 
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -40,7 +38,6 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.MessageInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -174,12 +171,13 @@
                         //no input messagePartInfo
                         return;
                     }
+                    
                     if (msgInfo != null && msgInfo.getMessageParts() != null 
                         && msgInfo.getMessageParts().size() > 0) {
                         assert msgInfo.getMessageParts().size() > paramNum;
                         p = msgInfo.getMessageParts().get(paramNum);
                     } else {
-                        p = findMessagePart(exchange, operations, elName, client, paramNum);
+                        p = findMessagePart(exchange, operations, elName, client, paramNum, message);
                     }
     
                     if (p == null) {
@@ -252,44 +250,7 @@
         MessageInfo msgInfo = getMessageInfo(message, operation, requestor);
         return setMessage(message, operation, requestor, si, msgInfo);
     }
-    private MessageInfo setMessage(Message message, BindingOperationInfo operation,
-                                   boolean requestor, ServiceInfo si,
-                                   MessageInfo msgInfo) {
-        message.put(MessageInfo.class, msgInfo);
-
-        Exchange ex = message.getExchange();
-        ex.put(BindingOperationInfo.class, operation);
-        ex.put(OperationInfo.class, operation.getOperationInfo());
-        ex.setOneWay(operation.getOperationInfo().isOneWay());
-
-        //Set standard MessageContext properties required by JAX_WS, but not specific to JAX_WS.
-        message.put(Message.WSDL_OPERATION, operation.getName());
-
-        QName serviceQName = si.getName();
-        message.put(Message.WSDL_SERVICE, serviceQName);
-
-        QName interfaceQName = si.getInterface().getName();
-        message.put(Message.WSDL_INTERFACE, interfaceQName);
-
-        EndpointInfo endpointInfo = ex.get(Endpoint.class).getEndpointInfo();
-        QName portQName = endpointInfo.getName();
-        message.put(Message.WSDL_PORT, portQName);
 
-        
-        URI wsdlDescription = endpointInfo.getProperty("URI", URI.class);
-        if (wsdlDescription == null) {
-            String address = endpointInfo.getAddress();
-            try {
-                wsdlDescription = new URI(address + "?wsdl");
-            } catch (URISyntaxException e) {
-                //do nothing
-            }
-            endpointInfo.setProperty("URI", wsdlDescription);
-        }
-        message.put(Message.WSDL_DESCRIPTION, wsdlDescription);
-
-        return msgInfo;
-    }
     
     protected BindingOperationInfo getBindingOperationInfo(Exchange exchange, QName name,
                                                            boolean client) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/URIMappingInterceptor.java Tue May 12 20:08:51 2009
@@ -35,11 +35,15 @@
 import org.apache.cxf.common.util.CollectionUtils;
 import org.apache.cxf.common.util.PrimitiveUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.util.XMLSchemaQNames;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.frontend.MethodDispatcher;
+import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
@@ -74,12 +78,40 @@
         if (op == null || opName == null || op.getName() == null
             || StringUtils.isEmpty(op.getName().getLocalPart())
             || !opName.equals(op.getName().getLocalPart())) {
-            throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_PATH", LOG, opName,
-                                                                   message.get(Message.PATH_INFO)));
+            
+            if (!Boolean.TRUE.equals(message.getContextualProperty(NO_VALIDATE_PARTS))) {
+                throw new Fault(new org.apache.cxf.common.i18n.Message("NO_OPERATION_PATH", LOG, opName,
+                                                                       message.get(Message.PATH_INFO)));
+            }
+            MessageContentsList params = new MessageContentsList();
+            params.add(null);
+            message.setContent(List.class, params);
+            if (op == null) {
+                op = findAnyOp(message.getExchange());
+            }
+            if (op != null) {
+                message.getExchange().put(BindingOperationInfo.class, op);
+            }
+        } else {
+            message.getExchange().put(BindingOperationInfo.class, op);
+            MessageContentsList params = getParameters(message, op);
+            message.setContent(List.class, params);
+        }
+    }
+
+    private BindingOperationInfo findAnyOp(Exchange exchange) {
+        Endpoint ep = exchange.get(Endpoint.class);
+        BindingInfo service = ep.getEndpointInfo().getBinding();
+        
+        for (BindingOperationInfo b : service.getOperations()) {
+            if (b.getInput() != null && !b.getInput().getMessageInfo().getMessageParts().isEmpty()) {
+                MessagePartInfo inf = b.getInput().getMessageInfo().getMessagePart(0);
+                if (XMLSchemaQNames.XSD_ANY.equals(inf.getTypeQName())) {
+                    return b;
+                }
+            }
         }
-        message.getExchange().put(BindingOperationInfo.class, op);
-        MessageContentsList params = getParameters(message, op);
-        message.setContent(List.class, params);
+        return null;
     }
 
     private Method getMethod(Message message, BindingOperationInfo operation) {        

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Tue May 12 20:08:51 2009
@@ -20,7 +20,6 @@
 package org.apache.cxf.jaxws;
 
 import java.net.HttpURLConnection;
-import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Future;
 import java.util.logging.Logger;
@@ -28,17 +27,9 @@
 import javax.activation.DataSource;
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.SOAPPart;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Binding;
 import javax.xml.ws.BindingProvider;
@@ -53,27 +44,19 @@
 import javax.xml.ws.soap.SOAPBinding;
 import javax.xml.ws.soap.SOAPFaultException;
 
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Node;
 
-import org.apache.cxf.binding.soap.SoapFault;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
-import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.SAAJOutEndingInterceptor;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ClientCallback;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.jaxws.context.WrappedMessageContext;
+import org.apache.cxf.jaxws.interceptors.MessageModeInInterceptor;
+import org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor;
 import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
-import org.apache.cxf.message.MessageContentsList;
-import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessageInfo;
@@ -81,11 +64,6 @@
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.staxutils.OverlayW3CDOMStreamWriter;
-import org.apache.cxf.staxutils.StaxSource;
-import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.cxf.staxutils.W3CDOMStreamReader;
-import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 
 public class DispatchImpl<T> implements Dispatch<T>, BindingProvider {
     private static final Logger LOG = LogUtils.getL7dLogger(DispatchImpl.class);
@@ -120,9 +98,15 @@
             } else if (m == Service.Mode.MESSAGE) {
                 SAAJOutInterceptor saajOut = new SAAJOutInterceptor();
                 client.getOutInterceptors().add(saajOut);
-                client.getOutInterceptors().add(new MessageModeOutInterceptor(saajOut));
+                client.getOutInterceptors().
+                    add(new MessageModeOutInterceptor(saajOut,
+                                                      client.getEndpoint()
+                                                          .getBinding().getBindingInfo().getName()));
                 client.getInInterceptors().add(new SAAJInInterceptor());
-                client.getInInterceptors().add(new MessageModeInInterceptor(clazz));
+                client.getInInterceptors()
+                    .add(new MessageModeInInterceptor(clazz, 
+                                                      client.getEndpoint()
+                                                          .getBinding().getBindingInfo().getName()));
             }
         } else if (m == Service.Mode.PAYLOAD 
             && binding instanceof SOAPBinding
@@ -308,128 +292,4 @@
     public Client getClient() {
         return client;
     }
-    
-    
-    static class MessageModeOutInterceptor extends AbstractSoapInterceptor {
-        SAAJOutInterceptor saajOut;
-        public MessageModeOutInterceptor(SAAJOutInterceptor saajOut) {
-            super(Phase.PRE_PROTOCOL);
-            addBefore(SAAJOutInterceptor.class.getName());
-            this.saajOut = saajOut;
-        }
-
-        public void handleMessage(SoapMessage message) throws Fault {
-            if (!isDispatch(message.getMessage())) {
-                LOG.info("Dispatch interceptor bailing on unrelated message");
-                return;
-            }
-
-            MessageContentsList list = (MessageContentsList)message.getContent(List.class);
-            Object o = list.get(0);
-            
-            SOAPMessage soapMessage = null;
-            
-            if (o instanceof SOAPMessage) {
-                soapMessage = (SOAPMessage)o;
-            } else {
-                try {
-                    MessageFactory factory = saajOut.getFactory(message);
-                    soapMessage = factory.createMessage();
-                    SOAPPart part = soapMessage.getSOAPPart();
-                    if (o instanceof Source) {
-                        StaxUtils.copy((Source)o, new W3CDOMStreamWriter(part));
-                    }
-                } catch (SOAPException e) {
-                    throw new SoapFault("Error creating SOAPMessage", e, 
-                                        message.getVersion().getSender());
-                } catch (XMLStreamException e) {
-                    throw new SoapFault("Error creating SOAPMessage", e, 
-                                        message.getVersion().getSender());
-                }
-            }
-            message.setContent(SOAPMessage.class, soapMessage);
-            
-            if (!message.containsKey(SAAJOutInterceptor.ORIGINAL_XML_WRITER)) {
-                XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
-                message.put(SAAJOutInterceptor.ORIGINAL_XML_WRITER, origWriter);
-            }
-            W3CDOMStreamWriter writer = new OverlayW3CDOMStreamWriter(soapMessage.getSOAPPart());
-            // Replace stax writer with DomStreamWriter
-            message.setContent(XMLStreamWriter.class, writer);
-            message.setContent(SOAPMessage.class, soapMessage);
-            
-            DocumentFragment frag = soapMessage.getSOAPPart().createDocumentFragment();
-            try {
-                Node body = soapMessage.getSOAPBody();
-                Node nd = body.getFirstChild();
-                while (nd != null) {
-                    body.removeChild(nd);
-                    frag.appendChild(nd);
-                    nd = soapMessage.getSOAPBody().getFirstChild();
-                    list.set(0, frag);
-                }
-            } catch (Exception ex) {
-                throw new Fault(ex);
-            }
-            
-            
-            // Add a final interceptor to write the message
-            message.getInterceptorChain().add(SAAJOutEndingInterceptor.INSTANCE);
-        }
-        
-    }
-
-    static class MessageModeInInterceptor extends AbstractSoapInterceptor {
-        Class<?> type;
-        public MessageModeInInterceptor(Class<?> c) {
-            super(Phase.POST_LOGICAL);
-            type = c;
-        }
-
-        public void handleMessage(SoapMessage message) throws Fault {
-            if (!isDispatch(message.getMessage())) {
-                LOG.info("Dispatch interceptor bailing on unrelated message");
-                return;
-            }
-
-            SOAPMessage m = message.getContent(SOAPMessage.class);
-            MessageContentsList list = (MessageContentsList)message.getContent(List.class); 
-            if (list == null) {
-                list = new MessageContentsList();
-                message.setContent(List.class, list);
-            }
-            Object o = m;
-            
-            if (StreamSource.class.isAssignableFrom(type)) {
-                try {
-                    CachedOutputStream out = new CachedOutputStream();
-                    try {
-                        XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
-                        StaxUtils.copy(new DOMSource(m.getSOAPPart()), xsw);
-                        xsw.close();
-                        o = new StreamSource(out.getInputStream());
-                    } finally {
-                        out.close();
-                    }
-                } catch (Exception e) {
-                    throw new Fault(e);
-                }
-            } else if (SAXSource.class.isAssignableFrom(type)) {
-                o = new StaxSource(new W3CDOMStreamReader(m.getSOAPPart()));
-            } else if (Source.class.isAssignableFrom(type)) {
-                o = new DOMSource(m.getSOAPPart());
-            }
-            
-            list.set(0, o);
-        }
-    }
-
-    protected static boolean isDispatch(org.apache.cxf.message.Message message) {   
-        BindingOperationInfo boi = message.getExchange().get(BindingOperationInfo.class);
-        return boi != null 
-               && DISPATCH_NS.equals(boi.getName().getNamespaceURI())
-               && (INVOKE_NAME.equals(boi.getName().getLocalPart()) 
-                   || INVOKE_ONEWAY_NAME.equals(boi.getName().getLocalPart()));
-    }
-
 }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsServerFactoryBean.java Tue May 12 20:08:51 2009
@@ -28,7 +28,6 @@
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.soap.SOAPBinding;
 
-import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.soap.Soap12;
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.endpoint.Endpoint;
@@ -158,7 +157,7 @@
         BindingInfo bindingInfo = super.createBindingInfo();        
 
         if (implInfo.isWebServiceProvider()) {
-            bindingInfo.setProperty(AbstractBindingFactory.DATABINDING_DISABLED, Boolean.TRUE);
+            bindingInfo.getService().setProperty("soap.force.doclit.bare", Boolean.TRUE);
         }
 
         return bindingInfo;

Added: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java?rev=774058&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java (added)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java Tue May 12 20:08:51 2009
@@ -0,0 +1,253 @@
+/**
+ * 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.jaxws.interceptors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.cxf.attachment.AttachmentUtil;
+import org.apache.cxf.helpers.LoadingByteArrayOutputStream;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.staxutils.StaxSource;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamReader;
+
+public class MessageModeInInterceptor extends AbstractPhaseInterceptor<Message> {
+    Class<?> type;
+    QName bindingName;
+    
+    Class<?> soapMsgClass;
+    
+    public MessageModeInInterceptor(Class<?> c, QName bName) {
+        super(Phase.POST_LOGICAL);
+        bindingName = bName;
+        type = c;
+        try {
+            soapMsgClass = Class.forName("javax.xml.soap.SOAPMessage");
+        } catch (Throwable t) {
+            soapMsgClass = null;
+        }
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        if (!bindingName.equals(message.getExchange().get(BindingOperationInfo.class)
+                               .getBinding().getName())) {
+            return;
+        }
+        Object o = message.getContent(soapMsgClass);
+        if (o != null) {
+            doFromSoapMessage(message, o);
+        } else if (DataSource.class.isAssignableFrom(type)) {
+            doDataSource(message);
+        }
+
+    }
+
+    private void doDataSource(final Message message) {
+        MessageContentsList list = (MessageContentsList)message.getContent(List.class); 
+        //reconstitute all the parts into a Mime data source
+        if (message.getAttachments() != null && !message.getAttachments().isEmpty() 
+            && list != null 
+            && !list.isEmpty() && list.get(0) instanceof DataSource) {
+            list.set(0, new MultiPartDataSource(message, (DataSource)list.get(0)));
+        }
+    }
+
+    private void doFromSoapMessage(Message message, Object sm) {
+        SOAPMessage m = (SOAPMessage)sm;
+        MessageContentsList list = (MessageContentsList)message.getContent(List.class); 
+        if (list == null) {
+            list = new MessageContentsList();
+            message.setContent(List.class, list);
+        }
+        Object o = m;
+        
+        if (StreamSource.class.isAssignableFrom(type)) {
+            try {
+                CachedOutputStream out = new CachedOutputStream();
+                try {
+                    XMLStreamWriter xsw = StaxUtils.createXMLStreamWriter(out);
+                    StaxUtils.copy(new DOMSource(m.getSOAPPart()), xsw);
+                    xsw.close();
+                    o = new StreamSource(out.getInputStream());
+                } finally {
+                    out.close();
+                }
+            } catch (Exception e) {
+                throw new Fault(e);
+            }
+        } else if (SAXSource.class.isAssignableFrom(type)) {
+            o = new StaxSource(new W3CDOMStreamReader(m.getSOAPPart()));
+        } else if (Source.class.isAssignableFrom(type)) {
+            o = new DOMSource(m.getSOAPPart());
+        }
+        list.set(0, o);
+    }
+    
+    private static class MultiPartDataSource implements DataSource {
+        final Iterator<Attachment> atts;
+        final String contentType;
+        final String boundary;
+        final String start;
+        
+        final LoadingByteArrayOutputStream bout = new LoadingByteArrayOutputStream();
+        Writer writer;
+        
+        DataSource rootPart;
+        InputStream current;
+        boolean writingHeaders;
+        Attachment att;
+        
+        public MultiPartDataSource(Message message, DataSource root) {
+            atts = message.getAttachments().iterator();
+            String s = (String)message.get(Message.CONTENT_TYPE);
+            boundary = findBoundary(s);
+            start = findStart(s);
+            if (!s.contains(boundary)) {
+                s += "; boundary=\"" + boundary + "\"";
+            }
+            contentType = s;
+            rootPart = root;
+            try {
+                writer = new OutputStreamWriter(bout, "ASCII");
+                writer.append("Content-Type: ").append(contentType).append("\r\n\r\n");
+                writer.flush();
+                current = bout.createInputStream();
+            } catch (Exception e) {
+                //nothing
+            }
+        }
+
+        public String getContentType() {
+            return contentType;
+        }
+        public InputStream getInputStream() throws IOException {
+            return new InputStream() {
+                public int read() throws IOException {
+                    int i = current.read();
+                    if (i == -1) {
+                        nextCurrent();
+                        i = current.read();
+                    }
+                    return i;
+                }
+            };
+        }
+        private void nextCurrent() throws IOException {
+            if (rootPart != null) {
+                if (writingHeaders) {
+                    writingHeaders = false;
+                    current = rootPart.getInputStream();
+                    rootPart = null;
+                } else {
+                    writingHeaders = true;
+                    bout.reset();
+                    writer.append("--").append(boundary).append("\r\n");
+                    writer.append("Content-Type: ").append(rootPart.getContentType()).append("\r\n");
+                    writer.append("Content-ID: <").append(start).append(">\r\n\r\n");
+                    writer.flush();
+                    current = bout.createInputStream();
+                }
+            } else {
+                if (writingHeaders) {
+                    writingHeaders = false;
+                    current = att.getDataHandler().getInputStream();
+                } else if (atts.hasNext()) {
+                    att = atts.next();
+                    writingHeaders = true;
+                    bout.reset();
+                    writer.append("\r\n");
+                    writer.append("--").append(boundary).append("\r\n");
+                    Iterator<String> heads = att.getHeaderNames();
+                    while (heads.hasNext()) {
+                        String s = heads.next();
+                        writer.append(s).append(": ").append(att.getHeader(s)).append("\r\n");
+                    }
+                    writer.append("\r\n");
+                    writer.flush();
+                    current = bout.createInputStream();
+                }
+            }
+        }
+        public String getName() {
+            return null;
+        }
+        public OutputStream getOutputStream() throws IOException {
+            return null;
+        }
+
+        private String findStart(String ct) {
+            int idx = ct.indexOf("start=");
+            if (idx == -1) {
+                return "root";
+            }
+            ct = ct.substring(idx + 6);
+            if (ct.charAt(0) == '"') {
+                ct = ct.substring(1);
+                idx = ct.indexOf('"');
+                return ct.substring(0, idx);
+            }
+            idx = ct.indexOf(';');
+            if (idx == -1) {
+                return ct;
+            }
+            return ct.substring(0, idx);
+        }
+
+        private String findBoundary(String ct) {
+            int idx = ct.indexOf("boundary=");
+            if (idx == -1) {
+                return AttachmentUtil.getUniqueBoundaryValue();
+            }
+            ct = ct.substring(idx + 9);
+            if (ct.charAt(0) == '"') {
+                ct = ct.substring(1);
+                idx = ct.indexOf('"');
+                return ct.substring(0, idx);
+            }
+            idx = ct.indexOf(';');
+            if (idx == -1) {
+                return ct;
+            }
+            return ct.substring(0, idx);
+        }
+    }
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeInInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=774058&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java (added)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java Tue May 12 20:08:51 2009
@@ -0,0 +1,205 @@
+/**
+ * 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.jaxws.interceptors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.attachment.AttachmentDeserializer;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.SAAJOutEndingInterceptor;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageContentsList;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.staxutils.OverlayW3CDOMStreamWriter;
+import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamWriter;
+
+public class MessageModeOutInterceptor extends AbstractPhaseInterceptor<Message> {
+    MessageModeOutInterceptorInternal internal;
+    SAAJOutInterceptor saajOut;
+    Class<?> type;
+    QName bindingName;
+
+    public MessageModeOutInterceptor(SAAJOutInterceptor saajOut, QName bname) {
+        super(Phase.PREPARE_SEND);
+        this.saajOut = saajOut;
+        this.bindingName = bname;
+        internal = new MessageModeOutInterceptorInternal();
+    }
+    public MessageModeOutInterceptor(Class<?> t, QName bname) {
+        super(Phase.PREPARE_SEND);
+        type = t;
+        this.bindingName = bname;
+    }
+    public void handleMessage(Message message) throws Fault {
+        if (!bindingName.equals(message.getExchange().get(BindingOperationInfo.class)
+                                .getBinding().getName())) {
+            return;
+        }
+        if (saajOut != null) {
+            doSoap(message);
+        } else if (DataSource.class.isAssignableFrom(type)) {
+            //datasource stuff, must check if multi-source
+            MessageContentsList list = (MessageContentsList)message.getContent(List.class);
+            DataSource ds = (DataSource)list.get(0);
+            String ct = ds.getContentType();
+            if (ct.toLowerCase().contains("multipart/related")) {
+                Message msg = new MessageImpl();
+                msg.setExchange(message.getExchange());
+                msg.put(Message.CONTENT_TYPE, ct);
+                try {
+                    msg.setContent(InputStream.class, ds.getInputStream());
+                    AttachmentDeserializer deser = new AttachmentDeserializer(msg);
+                    deser.initializeAttachments();
+                } catch (IOException ex) {
+                    throw new Fault(ex);
+                }
+                message.setAttachments(msg.getAttachments());
+                final InputStream in = msg.getContent(InputStream.class);
+                final String ct2 = (String)msg.get(Message.CONTENT_TYPE);
+                list.set(0, new DataSource() {
+
+                    public String getContentType() {
+                        return ct2;
+                    }
+
+                    public InputStream getInputStream() throws IOException {
+                        return in;
+                    }
+
+                    public String getName() {
+                        return ct2;
+                    }
+
+                    public OutputStream getOutputStream() throws IOException {
+                        // TODO Auto-generated method stub
+                        return null;
+                    }
+                    
+                });
+            }
+        }
+        
+    }
+    
+    
+    private void doSoap(Message message) {
+        MessageContentsList list = (MessageContentsList)message.getContent(List.class);
+        Object o = list.get(0);
+        if (o instanceof SOAPMessage) {
+            SOAPMessage soapMessage = (SOAPMessage)o;
+            if (soapMessage.countAttachments() > 0) {
+                message.put("write.attachments", Boolean.TRUE);
+            }
+        }
+        message.getInterceptorChain().add(internal);
+    }
+    
+    private class MessageModeOutInterceptorInternal extends AbstractSoapInterceptor {
+        MessageModeOutInterceptorInternal() {
+            super(Phase.PRE_PROTOCOL);
+            addBefore(SAAJOutInterceptor.class.getName());
+        }
+        
+        public void handleMessage(SoapMessage message) throws Fault {
+            MessageContentsList list = (MessageContentsList)message.getContent(List.class);
+            Object o = list.get(0);
+            SOAPMessage soapMessage = null;
+            
+            if (o instanceof SOAPMessage) {
+                soapMessage = (SOAPMessage)o;
+                if (soapMessage.countAttachments() > 0) {
+                    message.put("write.attachments", Boolean.TRUE);
+                }
+            } else {
+                try {
+                    MessageFactory factory = saajOut.getFactory(message);
+                    soapMessage = factory.createMessage();
+                    SOAPPart part = soapMessage.getSOAPPart();
+                    if (o instanceof Source) {
+                        StaxUtils.copy((Source)o, new W3CDOMStreamWriter(part));
+                    }
+                } catch (SOAPException e) {
+                    throw new SoapFault("Error creating SOAPMessage", e, 
+                                        message.getVersion().getSender());
+                } catch (XMLStreamException e) {
+                    throw new SoapFault("Error creating SOAPMessage", e, 
+                                        message.getVersion().getSender());
+                }
+            }
+            message.setContent(SOAPMessage.class, soapMessage);
+            
+            if (!message.containsKey(SAAJOutInterceptor.ORIGINAL_XML_WRITER)) {
+                XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
+                message.put(SAAJOutInterceptor.ORIGINAL_XML_WRITER, origWriter);
+            }
+            W3CDOMStreamWriter writer = new OverlayW3CDOMStreamWriter(soapMessage.getSOAPPart());
+            // Replace stax writer with DomStreamWriter
+            message.setContent(XMLStreamWriter.class, writer);
+            message.setContent(SOAPMessage.class, soapMessage);
+            
+            DocumentFragment frag = soapMessage.getSOAPPart().createDocumentFragment();
+            try {
+                Node body = soapMessage.getSOAPBody();
+                Node nd = body.getFirstChild();
+                while (nd != null) {
+                    body.removeChild(nd);
+                    frag.appendChild(nd);
+                    nd = soapMessage.getSOAPBody().getFirstChild();
+                }
+                list.set(0, frag);
+            } catch (Exception ex) {
+                throw new Fault(ex);
+            }
+            BindingOperationInfo bop = message.getExchange().get(BindingOperationInfo.class);
+            if (bop != null && bop.isUnwrapped()) {
+                bop = bop.getWrappedOperation();
+                message.getExchange().put(BindingOperationInfo.class, bop);
+            }
+            
+            // Add a final interceptor to write the message
+            message.getInterceptorChain().add(SAAJOutEndingInterceptor.INSTANCE);
+        }
+    }
+        
+}
\ No newline at end of file

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Tue May 12 20:08:51 2009
@@ -26,6 +26,7 @@
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.ExtensionRegistry;
 import javax.xml.ws.Binding;
+import javax.xml.ws.Service.Mode;
 import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.soap.Addressing;
 import javax.xml.ws.soap.AddressingFeature;
@@ -34,30 +35,32 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.SoapBinding;
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
 import org.apache.cxf.binding.xml.XMLBinding;
 import org.apache.cxf.endpoint.EndpointException;
 import org.apache.cxf.endpoint.EndpointImpl;
 import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.jaxws.binding.DefaultBindingImpl;
 import org.apache.cxf.jaxws.binding.http.HTTPBindingImpl;
 import org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl;
-import org.apache.cxf.jaxws.handler.logical.DispatchLogicalHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultInInterceptor;
 import org.apache.cxf.jaxws.handler.logical.LogicalHandlerFaultOutInterceptor;
 import org.apache.cxf.jaxws.handler.logical.LogicalHandlerInInterceptor;
 import org.apache.cxf.jaxws.handler.logical.LogicalHandlerOutInterceptor;
-import org.apache.cxf.jaxws.handler.soap.DispatchSOAPHandlerInterceptor;
 import org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultInInterceptor;
 import org.apache.cxf.jaxws.handler.soap.SOAPHandlerFaultOutInterceptor;
 import org.apache.cxf.jaxws.handler.soap.SOAPHandlerInterceptor;
 import org.apache.cxf.jaxws.interceptors.HolderInInterceptor;
 import org.apache.cxf.jaxws.interceptors.HolderOutInterceptor;
+import org.apache.cxf.jaxws.interceptors.MessageModeInInterceptor;
+import org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor;
 import org.apache.cxf.jaxws.interceptors.SwAInInterceptor;
 import org.apache.cxf.jaxws.interceptors.SwAOutInterceptor;
 import org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor;
 import org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor;
-import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -104,39 +107,50 @@
         
         List<Interceptor> in = super.getInInterceptors();       
         List<Interceptor> out = super.getOutInterceptors();
+
+        boolean isProvider = implInfo != null && implInfo.isWebServiceProvider();
+        Class<?> clazz = implInfo != null && isProvider ? implInfo.getProviderParameterType() : null;
+        Mode mode = implInfo != null && isProvider ? implInfo.getServiceMode() : null;
         
-        if (implInfo != null && implInfo.isWebServiceProvider()) {
-            DispatchLogicalHandlerInterceptor slhi = new DispatchLogicalHandlerInterceptor(jaxwsBinding,
-                Phase.USER_LOGICAL);
-            in.add(slhi);
-            out.add(new DispatchLogicalHandlerInterceptor(jaxwsBinding));
-
-            if (getBinding() instanceof SoapBinding) {
-                in.add(new DispatchSOAPHandlerInterceptor(jaxwsBinding));
-                out.add(new DispatchSOAPHandlerInterceptor(jaxwsBinding));
-            } 
-        } else {
-            // Inbound chain
-            in.add(new LogicalHandlerInInterceptor(jaxwsBinding));
+        if (isProvider) {
+            s.put(AbstractInDatabindingInterceptor.NO_VALIDATE_PARTS, Boolean.TRUE);
+        }
+
+        // Inbound chain
+        in.add(new LogicalHandlerInInterceptor(jaxwsBinding));
+        if (!isProvider) {
             in.add(new WrapperClassInInterceptor());
             in.add(new HolderInInterceptor());
-            if (getBinding() instanceof SoapBinding) {
-                in.add(new SOAPHandlerInterceptor(jaxwsBinding));
-                in.add(new SwAInInterceptor());
-                getOutInterceptors().add(new SwAOutInterceptor());
-            } else {
-                // TODO: what for non soap bindings?
+        }
+        if (getBinding() instanceof SoapBinding) {
+            in.add(new SOAPHandlerInterceptor(jaxwsBinding));
+            in.add(new SwAInInterceptor());
+            getOutInterceptors().add(new SwAOutInterceptor());
+            if (isProvider && mode == Mode.MESSAGE) {
+                in.add(new SAAJInInterceptor());
             }
+        }
+        if (isProvider && mode == Mode.MESSAGE) {
+            in.add(new MessageModeInInterceptor(clazz, getBinding().getBindingInfo().getName()));            
+        }
 
-            // Outbound chain
-            out.add(new LogicalHandlerOutInterceptor(jaxwsBinding));
+        // Outbound chain
+        out.add(new LogicalHandlerOutInterceptor(jaxwsBinding));
+        if (!isProvider) {
             out.add(new WrapperClassOutInterceptor());
             out.add(new HolderOutInterceptor());
-            if (getBinding() instanceof SoapBinding) {
-                out.add(new SOAPHandlerInterceptor(jaxwsBinding));
+        }
+        if (getBinding() instanceof SoapBinding) {
+            out.add(new SOAPHandlerInterceptor(jaxwsBinding));
+            if (mode == Mode.MESSAGE) {
+                SAAJOutInterceptor saajOut = new SAAJOutInterceptor();
+                out.add(saajOut);
+                out.add(new MessageModeOutInterceptor(saajOut,
+                                                      getBinding().getBindingInfo().getName()));
             }
+        } else if (isProvider) {
+            out.add(new MessageModeOutInterceptor(clazz, getBinding().getBindingInfo().getName()));
         }
-      
         
         //Outbound fault chain
         List<Interceptor> outFault = super.getOutFaultInterceptors();    
@@ -152,6 +166,7 @@
             inFault.add(new SOAPHandlerFaultInInterceptor(jaxwsBinding));
         }
         
+        
         if (ei != null) {
             if (!isFromWsdl) {
                 buildWsdlExtensibilities(ei.getBinding());

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Tue May 12 20:08:51 2009
@@ -41,7 +41,6 @@
 import javax.xml.ws.BindingType;
 import javax.xml.ws.FaultAction;
 import javax.xml.ws.Service;
-import javax.xml.ws.Service.Mode;
 import javax.xml.ws.WebFault;
 import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.soap.Addressing;
@@ -50,11 +49,11 @@
 import javax.xml.ws.soap.MTOMFeature;
 import javax.xml.ws.soap.SOAPBinding;
 
-import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.common.util.XMLSchemaQNames;
 import org.apache.cxf.databinding.source.SourceDataBinding;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
@@ -63,17 +62,17 @@
 import org.apache.cxf.jaxws.JAXWSMethodDispatcher;
 import org.apache.cxf.jaxws.JAXWSProviderMethodDispatcher;
 import org.apache.cxf.jaxws.WrapperClassGenerator;
-import org.apache.cxf.jaxws.interceptors.DispatchInDatabindingInterceptor;
-import org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterceptor;
 import org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor;
 import org.apache.cxf.service.factory.AbstractServiceConfiguration;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.BindingOperationInfo;
 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.service.model.ServiceInfo;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
@@ -121,7 +120,7 @@
         this.schemaLocationMapping.put(JAXWSAConstants.NS_WSA, 
                                        JAXWSAConstants.WSA_XSD);
     }
-    
+
     private void loadWSFeatureAnnotation(Class<?> serviceClass, Class<?> implementorClass) {
         List<WebServiceFeature> features = new ArrayList<WebServiceFeature>();
         MTOM mtom = implInfo.getImplementorClass().getAnnotation(MTOM.class);        
@@ -180,19 +179,6 @@
     }
 
     @Override
-    protected void initializeDefaultInterceptors() {
-        super.initializeDefaultInterceptors();
-
-        if (implInfo.isWebServiceProvider()) {
-            Class<?> type = implInfo.getProviderParameterType();
-            Mode mode = implInfo.getServiceMode();
-
-            getService().getInInterceptors().add(new DispatchInDatabindingInterceptor(type, mode));
-            getService().getOutInterceptors().add(new DispatchOutDatabindingInterceptor(mode));
-        }
-    }
-
-    @Override
     protected void initializeFaultInterceptors() {
         getService().getOutFaultInterceptors().add(new WebFaultOutInterceptor());
     }
@@ -244,7 +230,6 @@
         }
     }
 
-
     @Override
     protected void initializeWSDLOperations() {
         if (implInfo.isWebServiceProvider()) {
@@ -254,7 +239,6 @@
         }
     }
 
-
     protected void initializeWSDLOperationsForProvider() {
         Type[] genericInterfaces = getServiceClass().getGenericInterfaces();
         ParameterizedType pt = (ParameterizedType)genericInterfaces[0];
@@ -280,14 +264,65 @@
         
         try {
             Method invoke = getServiceClass().getMethod("invoke", c);
-
+            QName catchAll = new QName("http://cxf.apache.org/jaxws/provider", "invoke");
+            
             // Bind every operation to the invoke method.
             for (ServiceInfo si : getService().getServiceInfos()) {
-                for (OperationInfo o : si.getInterface().getOperations()) {
-                    getMethodDispatcher().bind(o, invoke);
-                }
-                for (BindingInfo bi : si.getBindings()) {
-                    bi.setProperty(AbstractBindingFactory.DATABINDING_DISABLED, Boolean.TRUE);
+                si.setProperty("soap.force.doclit.bare", Boolean.TRUE);
+                for (BindingInfo bind : si.getBindings()) {
+                    for (BindingOperationInfo bop : bind.getOperations()) {
+                        OperationInfo o = bop.getOperationInfo();
+                        if (o.getInput() != null) {
+                            if (o.getInput().getMessageParts().isEmpty()) {
+                                MessagePartInfo inf = o.getInput().addMessagePart(o.getName());
+                                inf.setConcreteName(o.getName());
+                                bop.getInput().setMessageParts(o.getInput().getMessageParts());
+                            }
+                            for (MessagePartInfo inf : o.getInput().getMessageParts()) {
+                                inf.setTypeClass(c);
+                            }
+                        }
+                        if (o.getOutput() != null) {
+                            if (o.getOutput().getMessageParts().isEmpty()) {
+                                MessagePartInfo inf = o.getOutput().addMessagePart(o.getName());
+                                inf.setConcreteName(new QName(o.getName().getNamespaceURI(),
+                                                              o.getName().getLocalPart() + "Response"));
+                                bop.getOutput().setMessageParts(o.getOutput().getMessageParts());
+                            }
+                            for (MessagePartInfo inf : o.getOutput().getMessageParts()) {
+                                inf.setTypeClass(c);
+                            }
+                        }
+                        getMethodDispatcher().bind(o, invoke);
+                    }
+                    BindingOperationInfo bop = bind.getOperation(catchAll);
+                    if (bop == null) {
+                        OperationInfo op = bind.getInterface().getOperation(catchAll);
+                        if (op == null) {
+                            op = bind.getInterface().addOperation(catchAll);
+                            String name = catchAll.getLocalPart();
+                            MessageInfo mInfo = op.createMessage(new QName(catchAll.getNamespaceURI(),
+                                                                           name + "Request"),
+                                                                           MessageInfo.Type.INPUT);
+                            op.setInput(catchAll.getLocalPart() + "Request", mInfo);
+                            MessagePartInfo mpi = mInfo.addMessagePart("parameters");
+                            mpi.setElement(true);
+                            mpi.setTypeClass(c);
+                            mpi.setTypeQName(XMLSchemaQNames.XSD_ANY);
+                            
+                            mInfo = op.createMessage(new QName(catchAll.getNamespaceURI(), 
+                                                               name + "Response"),
+                                                               MessageInfo.Type.OUTPUT);
+                            op.setOutput(name + "Response", mInfo);
+                            mpi = mInfo.addMessagePart("parameters");
+                            mpi.setElement(true);
+                            mpi.setTypeClass(c);
+                            mpi.setTypeQName(XMLSchemaQNames.XSD_ANY);
+                        
+                            BindingOperationInfo bo = new BindingOperationInfo(bind, op);
+                            bind.addOperation(bo);
+                        }
+                    }
                 }
             }
         } catch (SecurityException e) {
@@ -318,44 +353,6 @@
         }
     }
 
-    /**
-     * Create a mock service model with two operations - invoke and
-     * invokeOneway.
-     */
-    // @Override
-    // protected InterfaceInfo createInterface(ServiceInfo serviceInfo) {
-    // if (jaxWsImplementorInfo.isWebServiceProvider()) {
-    // return createInterfaceForProvider(serviceInfo);
-    // } else {
-    // return super.createInterface(serviceInfo);
-    // }
-    // }
-    //
-    // protected InterfaceInfo createInterfaceForProvider(ServiceInfo
-    // serviceInfo) {
-    //
-    // InterfaceInfo intf = new InterfaceInfo(serviceInfo, getInterfaceName());
-    //
-    // String ns = getServiceNamespace();
-    // OperationInfo invoke = intf.addOperation(new QName(ns, "invoke"));
-    //
-    // MessageInfo input = invoke.createMessage(new QName(ns, "input"));
-    // invoke.setInput("input", input);
-    //
-    // input.addMessagePart("in");
-    //
-    // MessageInfo output = invoke.createMessage(new QName(ns, "output"));
-    // invoke.setOutput("output", output);
-    //
-    // output.addMessagePart("out");
-    // //
-    // // OperationInfo invokeOneWay = intf.addOperation(new
-    // // QName(getServiceNamespace(), "invokeOneWay"));
-    // // invokeOneWay.setInput("input", input);
-    //
-    // return intf;
-    // }
-
 
     @Override
     protected Class<?> getBeanClass(Class<?> exClass) {
@@ -404,6 +401,7 @@
     protected final void initConfiguration(JaxWsImplementorInfo ii) {
         if (ii.isWebServiceProvider()) {
             jaxWsConfiguration = new WebServiceProviderConfiguration();
+            jaxWsConfiguration.setServiceFactory(this);
             getServiceConfigurations().add(0, jaxWsConfiguration);
             setWrapped(false);
             setDataBinding(new SourceDataBinding());
@@ -525,4 +523,13 @@
         super.buildServiceFromClass();
         getService().put(WS_FEATURES, getWsFeatures()); 
     }
+    
+    protected void initializeParameter(MessagePartInfo part, Class rawClass, Type type) {
+        if (implInfo.isWebServiceProvider()) {
+            part.setTypeQName(XMLSchemaQNames.XSD_ANY);
+            part.setTypeClass(rawClass);
+            return;
+        }
+        super.initializeParameter(part, rawClass, type);
+    }
 }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/WebServiceProviderConfiguration.java Tue May 12 20:08:51 2009
@@ -85,7 +85,7 @@
     
     @Override
     public Boolean isWrapped(Method m) {
-        return true;
+        return Boolean.FALSE;
     }
 }
 

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/provider/ProviderServiceFactoryTest.java Tue May 12 20:08:51 2009
@@ -23,7 +23,6 @@
 import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.binding.soap.SoapBinding;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
@@ -73,8 +72,6 @@
         Endpoint endpoint = server.getEndpoint();
         Binding binding = endpoint.getBinding();
         assertTrue(binding instanceof SoapBinding);
-        assertEquals(Boolean.TRUE, endpoint.getEndpointInfo().getBinding()
-            .getProperty(AbstractBindingFactory.DATABINDING_DISABLED));
     }
 
     @Test
@@ -146,7 +143,6 @@
         SoapBindingInfo sb = (SoapBindingInfo)endpoint.getEndpointInfo().getBinding();
         assertEquals("document", sb.getStyle());
         assertEquals(false, bean.isWrapped());
-        assertEquals(Boolean.TRUE, sb.getProperty(AbstractBindingFactory.DATABINDING_DISABLED));
 
         assertEquals(1, sb.getOperations().size());
         Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml");
@@ -185,7 +181,6 @@
         SoapBindingInfo sb = (SoapBindingInfo)endpoint.getEndpointInfo().getBinding();
         assertEquals("document", sb.getStyle());
         assertEquals(false, bean.isWrapped());
-        assertEquals(Boolean.TRUE, sb.getProperty(AbstractBindingFactory.DATABINDING_DISABLED));
 
         assertEquals(1, sb.getOperations().size());
         Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml");

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java Tue May 12 20:08:51 2009
@@ -495,8 +495,15 @@
         TestSAXSourceHandler tssh = new TestSAXSourceHandler();
         Future fd = disp.invokeAsync(saxSourceReq3, tssh);
         assertNotNull(fd);
+        
+        int count = 0;
         while (!fd.isDone()) {
+            if (count > 100) {
+                fail("Did not finish in 10 seconds");
+            }
             //wait
+            Thread.sleep(100);
+            count++;
         }
         String expected3 = "Hello TestSOAPInputMessage3";
         SAXSource saxSourceResp3 = tssh.getSAXSource();

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/AttachmentProviderXMLClientServerTest.java Tue May 12 20:08:51 2009
@@ -61,7 +61,8 @@
         connection.getOutputStream().close();
         is.close();
 
-        assertTrue("wrong content type", connection.getContentType().contains("multipart/related"));
+        assertTrue("wrong content type: " + connection.getContentType(),
+                   connection.getContentType().contains("multipart/related"));
         String input = IOUtils.toString(connection.getInputStream());
         
         int idx = input.indexOf("--uuid");

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWDOMSourcePayloadProvider.java Tue May 12 20:08:51 2009
@@ -71,6 +71,9 @@
         DOMSource response = new DOMSource();
 
         Node n = request.getNode();
+        if (n instanceof Document) {
+            n = ((Document)n).getDocumentElement();
+        }
         if (n.getLocalName().equals(sayHi.getLocalPart())) {
             response.setNode(sayHiResponse);
         } else if (n.getLocalName().equals(greetMe.getLocalPart())) {

Modified: cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java?rev=774058&r1=774057&r2=774058&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java (original)
+++ cxf/trunk/systests/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java Tue May 12 20:08:51 2009
@@ -19,9 +19,11 @@
 
 package org.apache.cxf.systest.provider;
 import java.io.InputStream;
+import java.util.Iterator;
 
 import javax.jws.HandlerChain;
 import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPMessage;
@@ -32,6 +34,8 @@
 
 import org.w3c.dom.Node;
 
+import org.apache.cxf.helpers.CastUtils;
+
 //The following wsdl file is used.
 //wsdlLocation = "/trunk/testutils/src/main/resources/wsdl/hello_world_rpc_lit.wsdl"
 @WebServiceProvider(portName = "SoapPortProviderRPCLit1", 
@@ -73,6 +77,17 @@
             }
             if (n.getLocalName().equals(sayHi.getLocalPart())) {
                 response = sayHiResponse;
+                if (request.countAttachments() > 0) {
+                    MessageFactory factory = MessageFactory.newInstance();            
+                    InputStream is = getClass().getResourceAsStream("resources/sayHiRpcLiteralResp.xml");
+                    response =  factory.createMessage(null, is);
+                    is.close();
+                    Iterator<AttachmentPart> it = CastUtils.cast(request.getAttachments(), 
+                                                                 AttachmentPart.class);
+                    while (it.hasNext()) {
+                        response.addAttachmentPart(it.next());
+                    }
+                }
             } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
                 response = greetMeResponse;
             } else {



Mime
View raw message