cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r617203 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/common/i18n/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/frontend/jaxws/src/main/generated/org/ rt/frontend/jaxws/src/main/java/org/apache...
Date Thu, 31 Jan 2008 19:54:36 GMT
Author: dkulp
Date: Thu Jan 31 11:54:27 2008
New Revision: 617203

URL: http://svn.apache.org/viewvc?rev=617203&view=rev
Log:
More JAXWS 2.1 updates/fixes
* Update HandlerChain building to DOM parse so we can handle the namespace checks, qname wildcards, etc... that we cannot do with the JAXB parsing (no way to query the namespace that belongs to a prefix with jaxb)
* Update JAXWS to use the (deprecated, but still in spec) @BindingType ids to turn on MTOM
* Update so MTOM works with SAAJOutInterceptor.  Made WSSec stuff specifically turn off MTOM only for security
* Change WSS4J interceptors to not require SAAJ interceptors to also be installed.  (they will call SAAJ directly if the saaj stuff isn't there)
* Implement the last two unimplemented JAXWS 2.1 methods

Added:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties   (with props)
Removed:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/generated/org/
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/javaee/
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/resources/webservices.xml
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java
    incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
    incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java
    incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
    incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/i18n/BundleUtils.java Thu Jan 31 11:54:27 2008
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.common.i18n;
 
+import java.text.MessageFormat;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
@@ -106,5 +107,17 @@
                                             Thread.currentThread().getContextClassLoader());
             
         }
+    }
+    
+    /**
+     * Encapsulates the logic to format a string based on the key in the resource bundle
+     * 
+     * @param b Resource bundle to use
+     * @param key The key in the bundle to lookup
+     * @param params the params to expand into the string
+     * @return the formatted string
+     */
+    public static String getFormattedString(ResourceBundle b, String key, Object ... params) {
+        return MessageFormat.format(b.getString(key), params);
     }
 }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJOutInterceptor.java Thu Jan 31 11:54:27 2008
@@ -93,8 +93,6 @@
                 // do nothing
             }
         }
-        //must turn off mtom when using SAAJ so binary is properly inlined
-        message.put(org.apache.cxf.message.Message.MTOM_ENABLED, false);
         
         // Add a final interceptor to write the message
         message.getInterceptorChain().add(new SAAJOutEndingInterceptor());

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties?rev=617203&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties Thu Jan 31 11:54:27 2008
@@ -0,0 +1,21 @@
+#
+#
+#    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.
+#
+#
+ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED = Class type {0} is not a subclass of EndpointReference or the Endpoint implementation does not support EndpointReferences of this type.

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/Messages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WebServiceContextImpl.java Thu Jan 31 11:54:27 2008
@@ -20,15 +20,24 @@
 package org.apache.cxf.jaxws.context;
 
 import java.security.Principal;
+import java.util.logging.Logger;
+
 import javax.xml.ws.EndpointReference;
 import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
 
 import org.w3c.dom.Element;
 
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.security.SecurityContext;
 
 public class WebServiceContextImpl implements WebServiceContext {
+    private static final Logger LOG = LogUtils.getL7dLogger(WebServiceContextImpl.class);
 
     private static ThreadLocal<MessageContext> context = new ThreadLocal<MessageContext>();
 
@@ -63,12 +72,33 @@
     
     //  TODO JAX-WS 2.1
     public EndpointReference getEndpointReference(Element... referenceParameters) {
-        throw new UnsupportedOperationException();
+        WrappedMessageContext ctx = (WrappedMessageContext)getMessageContext();
+        org.apache.cxf.message.Message msg = ctx.getWrappedMessage();
+        Endpoint ep = msg.getExchange().get(Endpoint.class);
+
+        W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
+        builder.address(ep.getEndpointInfo().getAddress());
+        builder.serviceName(ep.getService().getName());
+        builder.endpointName(ep.getEndpointInfo().getName());
+
+//        builder.wsdlDocumentLocation(wsdlLocation);        
+        if (referenceParameters != null) {
+            for (Element referenceParameter : referenceParameters) {
+                builder.referenceParameter(referenceParameter);
+            }
+        }
+        
+        return builder.build();
     }
 
     public <T extends EndpointReference> T getEndpointReference(Class<T> clazz,
                                                                 Element... referenceParameters) {
-        throw new UnsupportedOperationException();
+        if (W3CEndpointReference.class.isAssignableFrom(clazz)) {
+            return clazz.cast(getEndpointReference(referenceParameters));
+        } else {
+            throw new WebServiceException(new Message("ENDPOINTREFERENCE_TYPE_NOT_SUPPORTED",
+                                                      LOG, clazz.getName()).toString());
+        }
     }
 
     public static void setMessageContext(MessageContext ctx) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilder.java Thu Jan 31 11:54:27 2008
@@ -25,28 +25,36 @@
 import java.util.ResourceBundle;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.regex.Pattern;
 
 import javax.jws.HandlerChain;
 import javax.jws.WebService;
 import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.Handler;
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.jaxws.javaee.HandlerChainType;
-import org.apache.cxf.jaxws.javaee.HandlerChainsType;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.jaxws.javaee.PortComponentHandlerType;
 
 public class AnnotationHandlerChainBuilder extends HandlerChainBuilder {
 
     private static final Logger LOG = LogUtils.getL7dLogger(AnnotationHandlerChainBuilder.class);
     private static final ResourceBundle BUNDLE = LOG.getResourceBundle();
-
+    private static JAXBContext context;
+    
+    private ClassLoader classLoader;
+    
     public AnnotationHandlerChainBuilder() {
     }
 
@@ -62,6 +70,7 @@
     public List<Handler> buildHandlerChainFromClass(Class<?> clz, List<Handler> existingHandlers,
                                                     QName portQName, QName serviceQName, String bindingID) {
         LOG.fine("building handler chain");
+        classLoader = clz.getClassLoader();
         HandlerChainAnnotation hcAnn = findHandlerChainAnnotation(clz, true);
         List<Handler> chain = null;
         if (hcAnn == null) {
@@ -71,51 +80,48 @@
             hcAnn.validate();
 
             try {
-                JAXBContext jc = JAXBContext
-                        .newInstance(org.apache.cxf.jaxws.javaee.ObjectFactory.class);
-                Unmarshaller u = jc.createUnmarshaller();                
-                URL handlerFileURL  = resolveHandlerChainFile(clz, hcAnn.getFileName()); 
                 
+                URL handlerFileURL  = resolveHandlerChainFile(clz, hcAnn.getFileName()); 
                 if (handlerFileURL == null) {
                     throw new WebServiceException(new Message("HANDLER_CFG_FILE_NOT_FOUND_EXC", BUNDLE, hcAnn
                         .getFileName()).toString());
                 }
                 
-                JAXBElement<?> o = (JAXBElement<?>)u.unmarshal(handlerFileURL);
-
-                HandlerChainsType handlerChainsType = (HandlerChainsType) o.getValue();
-
-                if (null == handlerChainsType || handlerChainsType.getHandlerChain().size() == 0) {
-                    throw new WebServiceException(BUNDLE
-                            .getString("CHAIN_NOT_SPECIFIED_EXC"));
+                Document doc = XMLUtils.parse(handlerFileURL.openStream());
+                Element el = doc.getDocumentElement();
+                if (!"http://java.sun.com/xml/ns/javaee".equals(el.getNamespaceURI()) 
+                    || !"handler-chains".equals(el.getLocalName())) {
+                        
+                    String xml = XMLUtils.toString(el);
+                    throw new WebServiceException(
+                        BundleUtils.getFormattedString(BUNDLE,
+                                                       "NOT_VALID_ROOT_ELEMENT",
+                                                       "http://java.sun.com/xml/ns/javaee"
+                                                           .equals(el.getNamespaceURI()), 
+                                                       "handler-chains".equals(el.getLocalName()),
+                                                       xml, handlerFileURL));                    
                 }
-                
                 chain = new ArrayList<Handler>();
-                for (HandlerChainType hc : handlerChainsType.getHandlerChain()) {
-                    //TODO: match the namespace, match the wild card etc. JSR-181, Appendix B.
-                    if (hc.getPortNamePattern() != null && portQName != null) {
-                        String portNamePattern = hc.getPortNamePattern();
-                        String localPart = portNamePattern.substring(portNamePattern.indexOf(':') + 1,
-                                                                     portNamePattern.length());
-                        if (!localPart.equals(portQName.getLocalPart())) {
-                            continue;
-                        }
-                    }
-                    if (hc.getServiceNamePattern() != null && serviceQName != null) {
-                        String serviceNamePattern = hc.getServiceNamePattern();
-                        String localPart = serviceNamePattern.substring(serviceNamePattern.indexOf(':') + 1,
-                                                                     serviceNamePattern.length());
-                        if (!localPart.equals(serviceQName.getLocalPart())) {
-                            continue;
+                Node node = el.getFirstChild();
+                while (node != null) {
+                    if (node instanceof Element) {
+                        el = (Element)node;
+                        if (!el.getNamespaceURI().equals("http://java.sun.com/xml/ns/javaee") 
+                            || !el.getLocalName().equals("handler-chain")) {
+                                
+                            String xml = XMLUtils.toString(el);
+                            throw new WebServiceException(
+                                BundleUtils.getFormattedString(BUNDLE,
+                                                               "NOT_VALID_ELEMENT_IN_HANDLER",
+                                                               xml));                    
                         }
+                        processHandlerChainElement(el, chain,
+                                                   portQName, serviceQName, bindingID);
                     }
-                    if (hc.getProtocolBindings() != null && !hc.getProtocolBindings().isEmpty()
-                        && bindingID != null && !hc.getProtocolBindings().contains(bindingID)) {
-                        continue;
-                    }
-                    chain.addAll(buildHandlerChain(hc, clz.getClassLoader()));                    
+                    node = node.getNextSibling();
                 }
-
+            } catch (WebServiceException e) {
+                throw e;
             } catch (Exception e) {
                 throw new WebServiceException(BUNDLE.getString("CHAIN_NOT_SPECIFIED_EXC"), e);
             }
@@ -127,6 +133,112 @@
         return sortHandlers(chain);
     }
 
+    private void processHandlerChainElement(Element el, List<Handler> chain,
+                                            QName portQName, QName serviceQName, String bindingID) {
+        Node node = el.getFirstChild();
+        while (node != null) {
+            Node cur = node;
+            node = node.getNextSibling();            
+            if (cur instanceof Element) {
+                el = (Element)cur;
+                if (!el.getNamespaceURI().equals("http://java.sun.com/xml/ns/javaee")) {
+                    String xml = XMLUtils.toString(el);
+                    throw new WebServiceException(
+                        BundleUtils.getFormattedString(BUNDLE,
+                                                       "NOT_VALID_ELEMENT_IN_HANDLER",
+                                                       xml));                    
+                }
+                String name = el.getLocalName();
+                if ("port-name-pattern".equals(name)) {
+                    if (!patternMatches(el, portQName)) {
+                        return;
+                    }
+                } else if ("service-name-pattern".equals(name)) {
+                    if (!patternMatches(el, serviceQName)) {
+                        return;
+                    }
+                } else if ("protocol-bindings".equals(name)) {
+                    if (!protocolMatches(el, bindingID)) {
+                        return;
+                    }
+                } else if ("handler".equals(name)) {
+                    processHandlerElement(el, chain);
+                }
+            }
+        }        
+    }
+    private boolean protocolMatches(Element el, String id) {
+        if (id == null) {
+            return true;
+        }
+        String name = el.getTextContent().trim();
+        if ("##SOAP11_HTTP".equals(name)) {
+            name = "http://schemas.xmlsoap.org/wsdl/soap/http";
+        } else if ("##SOAP11_HTTP_MTOM".equals(name)) {
+            name = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true";
+        } else if ("##SOAP12_HTTP".equals(name)) {
+            name = "http://www.w3.org/2003/05/soap/bindings/HTTP/";
+        } else if ("##SOAP12_HTTP_MTOM".equals(name)) {
+            name = "http://www.w3.org/2003/05/soap/bindings/HTTP/?mtom=true";
+        } else if ("##XML_HTTP".equals(name)) {
+            name = "http://www.w3.org/2004/08/wsdl/http";
+        }
+        return name.contains(id);
+    }
+    private boolean patternMatches(Element el, QName comp) {
+        if (comp == null) {
+            return true;
+        }
+        String namePattern = el.getTextContent().trim();
+        if ("*".equals(namePattern)) {
+            return true;
+        }
+        if (!namePattern.contains(":")) {
+            String xml = XMLUtils.toString(el);
+            throw new WebServiceException(
+                BundleUtils.getFormattedString(BUNDLE,
+                                               "NOT_A_QNAME_PATTER",
+                                               namePattern, xml));                    
+        }
+        String localPart = namePattern.substring(namePattern.indexOf(':') + 1,
+                                                 namePattern.length());
+        String pfx = namePattern.substring(0, namePattern.indexOf(':'));
+        String ns = el.lookupNamespaceURI(pfx);
+        if (ns == null) {
+            ns = pfx;
+        }
+        if (!ns.equals(comp.getNamespaceURI())) {
+            return false;
+        }
+        if (localPart.contains("*")) {
+            //wildcard pattern matching
+            return Pattern.matches(localPart, comp.getLocalPart());
+        } else if (!localPart.equals(comp.getLocalPart())) {
+            return false;
+        }
+        return true;
+    }
+    
+    private void processHandlerElement(Element el, List<Handler> chain) {
+        try {
+            JAXBContext ctx = getContextForPortComponentHandlerType();
+            PortComponentHandlerType pt = ctx.createUnmarshaller()
+                .unmarshal(el, PortComponentHandlerType.class).getValue();
+            chain.addAll(buildHandlerChain(pt, classLoader));
+        } catch (JAXBException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+    
+    private static synchronized JAXBContext getContextForPortComponentHandlerType()
+        throws JAXBException {
+        if (context == null) {
+            context = JAXBContext.newInstance(PortComponentHandlerType.class);
+        }
+        return context;
+    }
+    
     public List<Handler> buildHandlerChainFromClass(Class<?> clz, QName portQName, QName serviceQName,
                                                     String bindingID) {
         return buildHandlerChainFromClass(clz, null, portQName, serviceQName, bindingID);
@@ -134,10 +246,6 @@
     
     protected URL resolveHandlerChainAnnotationFile(Class clazz, String name) {
         return clazz.getResource(name);
-    }
-    
-    public List<Handler> buildHandlerChainFromClass(Class<?> clz) {
-        return buildHandlerChainFromClass(clz, null, null, null);
     }
     
     private HandlerChainAnnotation findHandlerChainAnnotation(Class<?> clz, boolean searchSEI) {        

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainBuilder.java Thu Jan 31 11:54:27 2008
@@ -37,7 +37,6 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.injection.ResourceInjector;
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.jaxws.javaee.HandlerChainType;
 import org.apache.cxf.jaxws.javaee.ParamValueType;
 import org.apache.cxf.jaxws.javaee.PortComponentHandlerType;
 import org.apache.cxf.resource.ResourceManager;
@@ -58,12 +57,22 @@
         this(null);
     }
 
-    public List<Handler> buildHandlerChainFromConfiguration(HandlerChainType hc) {
+    public List<Handler> buildHandlerChainFromConfiguration(PortComponentHandlerType hc) {
         if (null == hc) {
             return null;
         }
         return sortHandlers(buildHandlerChain(hc, getHandlerClassLoader()));
     }
+    public List<Handler> buildHandlerChainFromConfiguration(List<PortComponentHandlerType> hc) {
+        if (null == hc || hc.size() == 0) {
+            return null;
+        }
+        List<Handler> handlers = new ArrayList<Handler>();
+        for (PortComponentHandlerType pt : hc) {
+            handlers.addAll(buildHandlerChain(pt, getHandlerClassLoader()));
+        }
+        return sortHandlers(handlers);
+    }
 
     // methods used by Geronimo to allow configuring things themselves
     public void setHandlerInitEnabled(boolean b) {
@@ -104,24 +113,22 @@
         return getClass().getClassLoader();
     }
 
-    protected List<Handler> buildHandlerChain(HandlerChainType hc, ClassLoader classLoader) {
+    protected List<Handler> buildHandlerChain(PortComponentHandlerType ht, ClassLoader classLoader) {
         List<Handler> handlerChain = new ArrayList<Handler>();
-        for (PortComponentHandlerType ht : hc.getHandler()) {
-            try {
-                LOG.log(Level.FINE, "loading handler", trimString(ht.getHandlerName().getValue()));
-
-                Class<? extends Handler> handlerClass = Class.forName(
-                                                                      trimString(ht.getHandlerClass()
-                                                                          .getValue()), true, classLoader)
-                    .asSubclass(Handler.class);
-
-                Handler handler = handlerClass.newInstance();
-                LOG.fine("adding handler to chain: " + handler);
-                configureHandler(handler, ht);
-                handlerChain.add(handler);
-            } catch (Exception e) {
-                throw new WebServiceException(BUNDLE.getString("HANDLER_INSTANTIATION_EXC"), e);
-            }
+        try {
+            LOG.log(Level.FINE, "loading handler", trimString(ht.getHandlerName().getValue()));
+
+            Class<? extends Handler> handlerClass = Class.forName(
+                                                                  trimString(ht.getHandlerClass()
+                                                                      .getValue()), true, classLoader)
+                .asSubclass(Handler.class);
+
+            Handler handler = handlerClass.newInstance();
+            LOG.fine("adding handler to chain: " + handler);
+            configureHandler(handler, ht);
+            handlerChain.add(handler);
+        } catch (Exception e) {
+            throw new WebServiceException(BUNDLE.getString("HANDLER_INSTANTIATION_EXC"), e);
         }
         return handlerChain;
     }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/Messages.properties Thu Jan 31 11:54:27 2008
@@ -25,5 +25,6 @@
 HANDLER_INSTANTIATION_EXC = Failed to instantiate handler
 CHAIN_NOT_SPECIFIED_EXC = Chain not specified
 SEI_LOAD_FAILURE_EXC = Failed to load service endpoint interface.
-
-
+NOT_A_QNAME_PATTER = Pattern {0} is not a qname pattern in xml {1}
+NOT_VALID_ELEMENT_IN_HANDLER = Element {0} is not allowed in handler chain
+NOT_VALID_ROOT_ELEMENT = {0} {1} Element {2} is not a valid root element in file {3}

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?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- 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 Thu Jan 31 11:54:27 2008
@@ -34,6 +34,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.Action;
 import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.BindingType;
 import javax.xml.ws.FaultAction;
 import javax.xml.ws.Service;
 import javax.xml.ws.Service.Mode;
@@ -43,6 +44,7 @@
 import javax.xml.ws.soap.AddressingFeature;
 import javax.xml.ws.soap.MTOM;
 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;
@@ -118,7 +120,16 @@
         }
         if (mtom != null) {
             features.add(new MTOMFeature(mtom.enabled(), mtom.threshold()));
+        } else {
+            //deprecated way to set mtom
+            BindingType bt = implInfo.getImplementorClass().getAnnotation(BindingType.class);
+            if (bt != null
+                && (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bt.value())
+                || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bt.value()))) {
+                features.add(new MTOMFeature(true));                
+            }
         }
+        
 
         Addressing addressing = null;
         if (implementorClass != null) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/AnnotationHandlerChainBuilderTest.java Thu Jan 31 11:54:27 2008
@@ -44,7 +44,11 @@
     public void testFindHandlerChainAnnotation() {
         HandlerTestImpl handlerTestImpl = new HandlerTestImpl();
         AnnotationHandlerChainBuilder chainBuilder = new AnnotationHandlerChainBuilder();
-        List<Handler> handlers = chainBuilder.buildHandlerChainFromClass(handlerTestImpl.getClass());
+        List<Handler> handlers = chainBuilder
+            .buildHandlerChainFromClass(handlerTestImpl.getClass(), 
+                                        null, 
+                                        null, 
+                                        null);
         assertNotNull(handlers);
         assertEquals(9, handlers.size());
         assertEquals(TestLogicalHandler.class, handlers.get(0).getClass());
@@ -68,7 +72,7 @@
         List<Handler> handlers = chainBuilder
             .buildHandlerChainFromClass(handlerTestImpl.getClass(), portQName, serviceQName, bindingID);
         assertNotNull(handlers);
-        assertEquals(9, handlers.size());
+        assertEquals(5, handlers.size());
     }
     
     @Test

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/HandlerChainBuilderTest.java Thu Jan 31 11:54:27 2008
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.jaxws.handler;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -30,7 +31,6 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.jaxws.javaee.FullyQualifiedClassType;
-import org.apache.cxf.jaxws.javaee.HandlerChainType;
 import org.apache.cxf.jaxws.javaee.ParamValueType;
 import org.apache.cxf.jaxws.javaee.PortComponentHandlerType;
 import org.easymock.classextension.EasyMock;
@@ -59,7 +59,7 @@
     @Test
     public void testBuildHandlerChainFromConfiguration() {
 
-        HandlerChainType hc = createHandlerChainType();
+        List<PortComponentHandlerType> hc = createHandlerChainType();
         List<Handler> chain = builder.buildHandlerChainFromConfiguration(hc);
 
         assertNotNull(chain);
@@ -76,12 +76,12 @@
 
     @Test
     public void testBuilderCallsInit() {
-        HandlerChainType hc = createHandlerChainType();
-        hc.getHandler().remove(3);
-        hc.getHandler().remove(2);
-        hc.getHandler().remove(1);
+        List<PortComponentHandlerType> hc = createHandlerChainType();
+        hc.remove(3);
+        hc.remove(2);
+        hc.remove(1);
 
-        PortComponentHandlerType h = hc.getHandler().get(0);
+        PortComponentHandlerType h = hc.get(0);
         List<ParamValueType> params = h.getInitParam();
 
         ParamValueType p = new ParamValueType();
@@ -117,12 +117,12 @@
 
     @Test
     public void testBuilderCallsInitWithNoInitParamValues() {
-        HandlerChainType hc = createHandlerChainType();
-        hc.getHandler().remove(3);
-        hc.getHandler().remove(2);
-        hc.getHandler().remove(1);
+        List<PortComponentHandlerType> hc = createHandlerChainType();
+        hc.remove(3);
+        hc.remove(2);
+        hc.remove(1);
 
-        PortComponentHandlerType h = hc.getHandler().get(0);
+        PortComponentHandlerType h = hc.get(0);
         List<ParamValueType> params = h.getInitParam();
 
         ParamValueType p = new ParamValueType();
@@ -143,13 +143,13 @@
 
     @Test
     public void testBuilderCannotLoadHandlerClass() {
-        HandlerChainType hc = createHandlerChainType();
-        hc.getHandler().remove(3);
-        hc.getHandler().remove(2);
-        hc.getHandler().remove(1);
+        List<PortComponentHandlerType> hc = createHandlerChainType();
+        hc.remove(3);
+        hc.remove(2);
+        hc.remove(1);
         FullyQualifiedClassType type = new FullyQualifiedClassType();
         type.setValue("no.such.class");
-        hc.getHandler().get(0).setHandlerClass(type);
+        hc.get(0).setHandlerClass(type);
 
         try {
             builder.buildHandlerChainFromConfiguration(hc);
@@ -161,9 +161,8 @@
         }
     }
 
-    private HandlerChainType createHandlerChainType() {
-        HandlerChainType hc = new HandlerChainType();
-        List<PortComponentHandlerType> handlers = hc.getHandler();
+    private List<PortComponentHandlerType> createHandlerChainType() {
+        List<PortComponentHandlerType> handlers = new ArrayList<PortComponentHandlerType>();
 
         PortComponentHandlerType h = new PortComponentHandlerType();
         org.apache.cxf.jaxws.javaee.String name = new org.apache.cxf.jaxws.javaee.String();
@@ -201,7 +200,7 @@
         h.setHandlerClass(type);
         handlers.add(h);
 
-        return hc;
+        return handlers;
     }
 
     public static class TestLogicalHandler implements LogicalHandler {

Modified: incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java Thu Jan 31 11:54:27 2008
@@ -67,6 +67,7 @@
                                                                  null,
                                                                  WSS4JInInterceptor.class.getName()
                                                                      + "-Time");
+    private SAAJInInterceptor saajIn = new SAAJInInterceptor();
     
     public WSS4JInInterceptor() {
         super();
@@ -82,6 +83,12 @@
 
     @SuppressWarnings("unchecked")
     public void handleMessage(SoapMessage msg) throws Fault {
+        SOAPMessage doc = msg.getContent(SOAPMessage.class);
+        if (doc == null) {
+            saajIn.handleMessage(msg);
+            doc = msg.getContent(SOAPMessage.class);
+        }
+        
         boolean doDebug = LOG.isLoggable(Level.FINE);
         boolean doTimeLog = TIME_LOG.isLoggable(Level.FINE);
 
@@ -113,12 +120,6 @@
             int doAction = WSSecurityUtil.decodeAction(action, actions);
 
             String actor = (String)getOption(WSHandlerConstants.ACTOR);
-
-            SOAPMessage doc = msg.getContent(SOAPMessage.class);
-
-            if (doc == null) {
-                throw new SoapFault(new Message("NO_SAAJ_DOC", LOG), version.getReceiver());
-            }
 
             CallbackHandler cbHandler = getCallback(reqData, doAction);
 

Modified: incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptor.java Thu Jan 31 11:54:27 2008
@@ -18,7 +18,9 @@
  */
 package org.apache.cxf.ws.security.wss4j;
 
+import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
 import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -30,10 +32,12 @@
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSSecurityException;
 import org.apache.ws.security.handler.RequestData;
@@ -48,144 +52,190 @@
             .getL7dLogger(WSS4JOutInterceptor.class,
                           null,
                           WSS4JOutInterceptor.class.getName() + "-Time");
-
+    private WSS4JOutInterceptorInternal ending;
+    private SAAJOutInterceptor saajOut = new SAAJOutInterceptor();
+    
     public WSS4JOutInterceptor() {
         super();
-
-        setPhase(Phase.POST_PROTOCOL);
+        setPhase(Phase.PRE_PROTOCOL);
+        getAfter().add(SAAJOutInterceptor.class.getName());
+        
+        ending = createEndingInterceptor();
     }
 
     public WSS4JOutInterceptor(Map<String, Object> props) {
         this();
         setProperties(props);
     }
-
     public void handleMessage(SoapMessage mc) throws Fault {
-        boolean doDebug = LOG.isLoggable(Level.FINE);
-        boolean doTimeDebug = TIME_LOG.isLoggable(Level.FINE);
-        SoapVersion version = mc.getVersion();
-
-        long t0 = 0;
-        long t1 = 0;
-        long t2 = 0;
-
-        if (doTimeDebug) {
-            t0 = System.currentTimeMillis();
+        //must turn off mtom when using WS-Sec so binary is inlined so it can
+        //be properly signed/encrypted/etc...
+        mc.put(org.apache.cxf.message.Message.MTOM_ENABLED, false);
+        
+        if (mc.getContent(SOAPMessage.class) == null) {
+            saajOut.handleMessage(mc);
         }
-
-        if (doDebug) {
-            LOG.fine("WSDoAllSender: enter invoke()");
+        
+        mc.getInterceptorChain().add(ending);
+    }    
+    
+    public final WSS4JOutInterceptorInternal createEndingInterceptor() {
+        return new WSS4JOutInterceptorInternal();
+    }
+    
+    final class WSS4JOutInterceptorInternal 
+        implements PhaseInterceptor<SoapMessage> {
+        public WSS4JOutInterceptorInternal() {
+            super();
         }
 
-        RequestData reqData = new RequestData();
-
-        reqData.setMsgContext(mc);
-        /*
-         * The overall try, just to have a finally at the end to perform some
-         * housekeeping.
-         */
-        try {
-            /*
-             * Get the action first.
-             */
-            Vector actions = new Vector();
-            String action = getString(WSHandlerConstants.ACTION, mc);
-            if (action == null) {
-                throw new SoapFault(new Message("NO_ACTION", LOG), version
-                        .getReceiver());
+        public void handleMessage(SoapMessage mc) throws Fault {
+            boolean doDebug = LOG.isLoggable(Level.FINE);
+            boolean doTimeDebug = TIME_LOG.isLoggable(Level.FINE);
+            SoapVersion version = mc.getVersion();
+    
+            long t0 = 0;
+            long t1 = 0;
+            long t2 = 0;
+    
+            if (doTimeDebug) {
+                t0 = System.currentTimeMillis();
             }
-
-            int doAction = WSSecurityUtil.decodeAction(action, actions);
-            if (doAction == WSConstants.NO_SECURITY) {
-                return;
+    
+            if (doDebug) {
+                LOG.fine("WSDoAllSender: enter invoke()");
             }
-
+    
+            RequestData reqData = new RequestData();
+    
+            reqData.setMsgContext(mc);
             /*
-             * For every action we need a username, so get this now. The
-             * username defined in the deployment descriptor takes precedence.
+             * The overall try, just to have a finally at the end to perform some
+             * housekeeping.
              */
-            reqData.setUsername((String) getOption(WSHandlerConstants.USER));
-            if (reqData.getUsername() == null
-                    || reqData.getUsername().equals("")) {
-                String username = (String) getProperty(reqData.getMsgContext(),
-                        WSHandlerConstants.USER);
-                if (username != null) {
-                    reqData.setUsername(username);
+            try {
+                /*
+                 * Get the action first.
+                 */
+                Vector actions = new Vector();
+                String action = getString(WSHandlerConstants.ACTION, mc);
+                if (action == null) {
+                    throw new SoapFault(new Message("NO_ACTION", LOG), version
+                            .getReceiver());
                 }
-            }
-
-            /*
-             * Now we perform some set-up for UsernameToken and Signature
-             * functions. No need to do it for encryption only. Check if
-             * username is available and then get a passowrd.
-             */
-            if ((doAction & (WSConstants.SIGN | WSConstants.UT | WSConstants.UT_SIGN)) != 0
-                    && (reqData.getUsername() == null
-                    || reqData.getUsername().equals(""))) {
+    
+                int doAction = WSSecurityUtil.decodeAction(action, actions);
+                if (doAction == WSConstants.NO_SECURITY) {
+                    return;
+                }
+    
                 /*
-                 * We need a username - if none throw an SoapFault. For
-                 * encryption there is a specific parameter to get a username.
+                 * For every action we need a username, so get this now. The
+                 * username defined in the deployment descriptor takes precedence.
                  */
-                throw new SoapFault(new Message("NO_USERNAME", LOG), version
-                        .getReceiver());
-            }
-            if (doDebug) {
-                LOG.fine("Action: " + doAction);
-                LOG.fine("Actor: " + reqData.getActor());
-            }
-            /*
-             * Now get the SOAP part from the request message and convert it
-             * into a Document. This forces CXF to serialize the SOAP request
-             * into FORM_STRING. This string is converted into a document.
-             * During the FORM_STRING serialization CXF performs multi-ref of
-             * complex data types (if requested), generates and inserts
-             * references for attachements and so on. The resulting Document
-             * MUST be the complete and final SOAP request as CXF would send it
-             * over the wire. Therefore this must shall be the last (or only)
-             * handler in a chain. Now we can perform our security operations on
-             * this request.
-             */
-            SOAPMessage saaj = mc.getContent(SOAPMessage.class);
-
-            if (saaj == null) {
-                LOG.warning("SAAJOutHandler must be enabled for WS-Security!");
-                throw new SoapFault(new Message("NO_SAAJ_DOC", LOG), version
-                        .getReceiver());
+                reqData.setUsername((String) getOption(WSHandlerConstants.USER));
+                if (reqData.getUsername() == null
+                        || reqData.getUsername().equals("")) {
+                    String username = (String) getProperty(reqData.getMsgContext(),
+                            WSHandlerConstants.USER);
+                    if (username != null) {
+                        reqData.setUsername(username);
+                    }
+                }
+    
+                /*
+                 * Now we perform some set-up for UsernameToken and Signature
+                 * functions. No need to do it for encryption only. Check if
+                 * username is available and then get a passowrd.
+                 */
+                if ((doAction & (WSConstants.SIGN | WSConstants.UT | WSConstants.UT_SIGN)) != 0
+                        && (reqData.getUsername() == null
+                        || reqData.getUsername().equals(""))) {
+                    /*
+                     * We need a username - if none throw an SoapFault. For
+                     * encryption there is a specific parameter to get a username.
+                     */
+                    throw new SoapFault(new Message("NO_USERNAME", LOG), version
+                            .getReceiver());
+                }
+                if (doDebug) {
+                    LOG.fine("Action: " + doAction);
+                    LOG.fine("Actor: " + reqData.getActor());
+                }
+                /*
+                 * Now get the SOAP part from the request message and convert it
+                 * into a Document. This forces CXF to serialize the SOAP request
+                 * into FORM_STRING. This string is converted into a document.
+                 * During the FORM_STRING serialization CXF performs multi-ref of
+                 * complex data types (if requested), generates and inserts
+                 * references for attachements and so on. The resulting Document
+                 * MUST be the complete and final SOAP request as CXF would send it
+                 * over the wire. Therefore this must shall be the last (or only)
+                 * handler in a chain. Now we can perform our security operations on
+                 * this request.
+                 */
+                SOAPMessage saaj = mc.getContent(SOAPMessage.class);
+    
+                if (saaj == null) {
+                    LOG.warning("SAAJOutHandler must be enabled for WS-Security!");
+                    throw new SoapFault(new Message("NO_SAAJ_DOC", LOG), version
+                            .getReceiver());
+                }
+    
+                Document doc = saaj.getSOAPPart();
+                /**
+                 * There is nothing to send...Usually happens when the provider
+                 * needs to send a HTTP 202 message (with no content)
+                 */
+                if (mc == null) {
+                    return;
+                }
+    
+                if (doTimeDebug) {
+                    t1 = System.currentTimeMillis();
+                }
+    
+                doSenderAction(doAction, doc, reqData, actions, !Boolean.TRUE
+                        .equals(getProperty(mc, org.apache.cxf.message.Message.REQUESTOR_ROLE)));
+    
+                if (doTimeDebug) {
+                    t2 = System.currentTimeMillis();
+                    TIME_LOG.fine("Send request: total= " + (t2 - t0)
+                            + " request preparation= " + (t1 - t0)
+                            + " request processing= " + (t2 - t1)
+                            + "\n");
+                }
+    
+                if (doDebug) {
+                    LOG.fine("WSDoAllSender: exit invoke()");
+                }
+            } catch (WSSecurityException e) {
+                throw new SoapFault(new Message("SECURITY_FAILED", LOG), e, version
+                        .getSender());
+            } finally {
+                reqData.clear();
+                reqData = null;
             }
+        }
 
-            Document doc = saaj.getSOAPPart();
-            /**
-             * There is nothing to send...Usually happens when the provider
-             * needs to send a HTTP 202 message (with no content)
-             */
-            if (mc == null) {
-                return;
-            }
+        public Set<String> getAfter() {
+            return Collections.emptySet();
+        }
 
-            if (doTimeDebug) {
-                t1 = System.currentTimeMillis();
-            }
+        public Set<String> getBefore() {
+            return Collections.emptySet();
+        }
 
-            doSenderAction(doAction, doc, reqData, actions, !Boolean.TRUE
-                    .equals(getProperty(mc, org.apache.cxf.message.Message.REQUESTOR_ROLE)));
+        public String getId() {
+            return WSS4JOutInterceptorInternal.class.getName();
+        }
 
-            if (doTimeDebug) {
-                t2 = System.currentTimeMillis();
-                TIME_LOG.fine("Send request: total= " + (t2 - t0)
-                        + " request preparation= " + (t1 - t0)
-                        + " request processing= " + (t2 - t1)
-                        + "\n");
-            }
+        public String getPhase() {
+            return Phase.POST_PROTOCOL;
+        }
 
-            if (doDebug) {
-                LOG.fine("WSDoAllSender: exit invoke()");
-            }
-        } catch (WSSecurityException e) {
-            throw new SoapFault(new Message("SECURITY_FAILED", LOG), e, version
-                    .getSender());
-        } finally {
-            reqData.clear();
-            reqData = null;
+        public void handleFault(SoapMessage message) {
+            //nothing
         }
     }
 }

Modified: incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java (original)
+++ incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java Thu Jan 31 11:54:27 2008
@@ -46,6 +46,7 @@
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.phase.Phase;
+import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.ws.security.WSSecurityEngineResult;
@@ -81,7 +82,8 @@
     public void testSignature() throws Exception {
         Document doc = readDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
@@ -142,7 +144,8 @@
     public void testDirectReferenceSignature() throws Exception {
         Document doc = readDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();

Modified: incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java?rev=617203&r1=617202&r2=617203&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JOutInterceptorTest.java Thu Jan 31 11:54:27 2008
@@ -25,6 +25,7 @@
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.handler.WSHandlerConstants;
 import org.junit.Test;
@@ -38,7 +39,8 @@
     public void testUsernameTokenText() throws Exception {
         SOAPMessage saaj = readSAAJDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
@@ -65,7 +67,8 @@
     public void testUsernameTokenDigest() throws Exception {
         SOAPMessage saaj = readSAAJDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
@@ -92,7 +95,8 @@
     public void testEncrypt() throws Exception {
         SOAPMessage saaj = readSAAJDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
@@ -117,7 +121,8 @@
     public void testSignature() throws Exception {
         SOAPMessage saaj = readSAAJDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
@@ -141,7 +146,8 @@
     public void testTimestamp() throws Exception {
         SOAPMessage saaj = readSAAJDocument("wsse-request-clean.xml");
 
-        WSS4JOutInterceptor handler = new WSS4JOutInterceptor();
+        WSS4JOutInterceptor ohandler = new WSS4JOutInterceptor();
+        PhaseInterceptor<SoapMessage> handler = ohandler.createEndingInterceptor();
 
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
@@ -149,8 +155,8 @@
 
         msg.setContent(SOAPMessage.class, saaj);
         
-        handler.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
-        handler.setProperty(WSHandlerConstants.SIG_PROP_FILE, "META-INF/cxf/outsecurity.properties");
+        ohandler.setProperty(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
+        ohandler.setProperty(WSHandlerConstants.SIG_PROP_FILE, "META-INF/cxf/outsecurity.properties");
         msg.put(WSHandlerConstants.USER, "myalias");
         msg.put("password", "myAliasPassword");
 



Mime
View raw message