cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r520969 - in /incubator/cxf/trunk/rt: bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/ frontend/jax...
Date Wed, 21 Mar 2007 18:13:52 GMT
Author: dandiep
Date: Wed Mar 21 11:13:50 2007
New Revision: 520969

URL: http://svn.apache.org/viewvc?view=rev&rev=520969
Log:
o Fix a problem where the SOAPAction wasn't being quoted.
o Add the ability to specify in/out/fault interceptors via Spring XML with
  the Server/Endpoint/ClientFactoryBeans.
o Fix a problem with the WSS4J interceptor not throwing exceptions.


Modified:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBeanDefinitionParser.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ServerBeanDefinitionParser.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInterceptor.java?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInterceptor.java
Wed Mar 21 11:13:50 2007
@@ -55,12 +55,19 @@
         if (boi == null) {
             value.add("\"\"");
         } else {
-            SoapOperationInfo soi = (SoapOperationInfo) boi.getExtensor(SoapOperationInfo.class);
           
-            value.add(soi == null ? "\"\"" : soi.getAction() == null ? "\"\"" : soi.getAction());
+            SoapOperationInfo soi = (SoapOperationInfo) boi.getExtensor(SoapOperationInfo.class);
+            String action = soi == null ? "\"\"" : soi.getAction() == null ? "\"\"" : soi.getAction();
+            if (!action.startsWith("\"")) {
+                action = new StringBuffer().append("\"").append(action).append("\"").toString();
+            }
+            
+            value.add(action);
         }
         Map<String, List<String>> reqHeaders = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS));
         if (reqHeaders == null) {
             reqHeaders = new HashMap<String, List<String>>();
+        }
+        if (reqHeaders.size() == 0) {
             message.put(Message.PROTOCOL_HEADERS, reqHeaders);
         }
         if (message.getVersion() instanceof Soap11 && !reqHeaders.containsKey("SOAPAction"))
{            

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBean.java?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBean.java
Wed Mar 21 11:13:50 2007
@@ -28,6 +28,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.jaxws.support.AbstractJaxWsServiceFactoryBean;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
@@ -40,7 +41,8 @@
  * Creates a JAX-WS Endpoint. Implements InitializingBean to make it easier for Spring
  * users to use.
  */
-public class EndpointFactoryBean implements FactoryBean, ApplicationContextAware {
+public class EndpointFactoryBean extends AbstractBasicInterceptorProvider
+    implements FactoryBean, ApplicationContextAware {
     private String address;
     private Bus bus;
     private Executor executor;
@@ -96,6 +98,21 @@
         if (publish) {
             endpoint.publish(address);
         }
+        
+        org.apache.cxf.endpoint.Endpoint cxfEp = endpoint.getServer().getEndpoint();
+        if (getInInterceptors() != null) {
+            cxfEp.getInInterceptors().addAll(getInInterceptors());
+        }
+        if (getOutInterceptors() != null) {
+            cxfEp.getOutInterceptors().addAll(getOutInterceptors());
+        }
+        if (getInFaultInterceptors() != null) {
+            cxfEp.getInFaultInterceptors().addAll(getInFaultInterceptors());
+        }
+        if (getOutFaultInterceptors() != null) {
+            cxfEp.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
+        }
+        
         return endpoint;
     }
 

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBeanDefinitionParser.java?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBeanDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointFactoryBeanDefinitionParser.java
Wed Mar 21 11:13:50 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.jaxws.spring;
 
+import java.util.List;
 import java.util.Map;
 
 import org.w3c.dom.Attr;
@@ -55,9 +56,14 @@
         for (int i = 0; i < children.getLength(); i++) {
             Node n = children.item(i);
             if (n.getNodeType() == Node.ELEMENT_NODE) {
+                String name = n.getLocalName();
                 if ("properties".equals(n.getLocalName())) {
                     Map map = ctx.getDelegate().parseMapElement((Element) n, bean.getBeanDefinition());
                     bean.addPropertyValue("properties", map);
+                } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
+                    || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name))
{
+                    List list = ctx.getDelegate().parseListElement((Element) n, bean.getBeanDefinition());
+                    bean.addPropertyValue(n.getLocalName(), list);
                 } else {
                     setFirstChildAsProperty((Element) n, ctx, bean, n.getLocalName());
                 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ServerBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ServerBeanDefinitionParser.java?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ServerBeanDefinitionParser.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ServerBeanDefinitionParser.java
Wed Mar 21 11:13:50 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.jaxws.spring;
 
+import java.util.List;
 import java.util.Map;
 
 import org.w3c.dom.Attr;
@@ -56,6 +57,7 @@
         for (int i = 0; i < children.getLength(); i++) {
             Node n = children.item(i);
             if (n.getNodeType() == Node.ELEMENT_NODE) {
+                String name = n.getLocalName();
                 if ("properties".equals(n.getLocalName())) {
                     Map map = ctx.getDelegate().parseMapElement((Element) n, bean.getBeanDefinition());
                     bean.addPropertyValue("properties", map);
@@ -65,6 +67,10 @@
                     setFirstChildAsProperty((Element) n, ctx, bean, "serviceFactory.invoker");
                 } else if ("binding".equals(n.getLocalName())) {
                     setFirstChildAsProperty((Element) n, ctx, bean, "bindingFactory");
+                }  else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
+                    || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name))
{
+                    List list = ctx.getDelegate().parseListElement((Element) n, bean.getBeanDefinition());
+                    bean.addPropertyValue(n.getLocalName(), list);
                 } else {
                     setFirstChildAsProperty((Element) n, ctx, bean, n.getLocalName());
                 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd
Wed Mar 21 11:13:50 2007
@@ -17,6 +17,10 @@
           <xsd:sequence>
             <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="implementor" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
             <xsd:element name="serviceFactory" type="xsd:anyType" minOccurs="0"/>
           </xsd:sequence>
@@ -41,7 +45,11 @@
             <xsd:element name="binding" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="executor" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="implementor" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="inFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="invoker" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outInterceptors" type="xsd:anyType" minOccurs="0"/>
+            <xsd:element name="outFaultInterceptors" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="properties" type="beans:mapType" minOccurs="0"/>
             <xsd:element name="serviceBean" type="xsd:anyType" minOccurs="0"/>
             <xsd:element name="serviceFactory" type="xsd:anyType" minOccurs="0"/>

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java
Wed Mar 21 11:13:50 2007
@@ -18,9 +18,16 @@
  */
 package org.apache.cxf.jaxws.spring;
 
-import junit.framework.TestCase;
+import java.util.List;
 
+import junit.framework.TestCase;
 import org.apache.cxf.binding.soap.SoapBindingInfoFactoryBean;
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.jaxws.service.Hello;
@@ -67,6 +74,32 @@
         
         bean = ctx.getBean("wsdlLocation");
         assertNotNull(bean);
+        
+        ep = (EndpointImpl) ctx.getBean("epWithInterceptors");
+        assertNotNull(ep);
+        Endpoint cxfEP = ep.getServer().getEndpoint();
+        List<Interceptor> inInterceptors = cxfEP.getInInterceptors();
+        boolean saaj = false;
+        boolean logging = false;
+        for (Interceptor<?> i : inInterceptors) {
+            if (i instanceof SAAJInInterceptor) {
+                saaj = true;
+            } else if (i instanceof LoggingInInterceptor) {
+                logging = true;
+            }
+        }
+        assertTrue(saaj);
+        assertTrue(logging);
+        
+        saaj = false;
+        logging = false;
+        for (Interceptor<?> i : cxfEP.getOutInterceptors()) {
+            if (i instanceof SAAJOutInterceptor) {
+                saaj = true;
+            } else if (i instanceof LoggingOutInterceptor) {
+                logging = true;
+            }
+        }
     }
     
     public void testServers() throws Exception {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/endpoints.xml
Wed Mar 21 11:13:50 2007
@@ -67,4 +67,19 @@
   <jaxws:endpoint id="wsdlLocation" 
     implementor="#greeter" address="http://localhost:8080/simpleWithAddress"
     wsdlLocation="wsdl/hello_world.wsdl"/>
+    
+      
+  <jaxws:endpoint id="epWithInterceptors" 
+    implementor="org.apache.cxf.jaxws.service.Hello"
+    address="http://localhost:8080/test">
+	<jaxws:inInterceptors>
+	  <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+	  <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
+	</jaxws:inInterceptors>
+	<jaxws:outInterceptors>
+	  <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+	  <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>
+	</jaxws:outInterceptors>
+  </jaxws:endpoint>
+    
 </beans>

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
(original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
Wed Mar 21 11:13:50 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointException;
+import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.factory.AbstractBindingInfoFactoryBean;
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
@@ -39,7 +40,7 @@
 import org.apache.cxf.ws.AbstractWSFeature;
 import org.apache.cxf.wsdl11.WSDLEndpointFactory;
 
-public abstract class AbstractEndpointFactory {
+public abstract class AbstractEndpointFactory extends AbstractBasicInterceptorProvider {
 
     private Bus bus;
     private String address;
@@ -51,7 +52,7 @@
     private QName endpointName;
     private Map<String, Object> properties;
     private List<AbstractWSFeature> features;
-    
+
     protected Endpoint createEndpoint() throws BusException, EndpointException {
         Service service = serviceFactory.getService();
         
@@ -85,6 +86,19 @@
         }
         
         service.getEndpoints().put(ep.getEndpointInfo().getName(), ep);
+        
+        if (getInInterceptors() != null) {
+            ep.getInInterceptors().addAll(getInInterceptors());
+        }
+        if (getOutInterceptors() != null) {
+            ep.getOutInterceptors().addAll(getOutInterceptors());
+        }
+        if (getInFaultInterceptors() != null) {
+            ep.getInFaultInterceptors().addAll(getInFaultInterceptors());
+        }
+        if (getOutFaultInterceptors() != null) {
+            ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
+        }
         return ep;
     }
 

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?view=diff&rev=520969&r1=520968&r2=520969
==============================================================================
--- 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
Wed Mar 21 11:13:50 2007
@@ -217,11 +217,11 @@
 
         } catch (WSSecurityException e) {
             LOG.log(Level.WARNING, "", e);
-            // TODO: what should we be doing?
+            throw new SoapFault(new Message("WSSECURITY_EX", LOG), e, version.getSender());
         } catch (XMLStreamException e) {
-            throw new SoapFault(new Message("STAX_EX", LOG), version.getSender());
+            throw new SoapFault(new Message("STAX_EX", LOG), e, version.getSender());
         } catch (SOAPException e) {
-            throw new SoapFault(new Message("SAAJ_EX", LOG), version.getSender());
+            throw new SoapFault(new Message("SAAJ_EX", LOG), e, version.getSender());
         } finally {
             reqData.clear();
             reqData = null;



Mime
View raw message