You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2010/05/25 09:15:52 UTC
svn commit: r947948 - in /cxf/trunk/rt/frontend/jaxws/src:
main/java/org/apache/cxf/jaxws/ServiceImpl.java
test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java
test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml
Author: ema
Date: Tue May 25 07:15:51 2010
New Revision: 947948
URL: http://svn.apache.org/viewvc?rev=947948&view=rev
Log:
[CXF-2822]:Added the interceptors in ClientFactoryBean to ClientIml. This made <jaxws:client> configuration work for dispatch client
Added:
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java
Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=947948&r1=947947&r2=947948&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue May 25 07:15:51 2010
@@ -621,7 +621,8 @@ public class ServiceImpl extends Service
for (AbstractFeature af : endpoint.getFeatures()) {
af.initialize(client, bus);
}
-
+ //CXF-2822
+ initIntercepors(client, clientFac);
if (executor != null) {
client.getEndpoint().setExecutor(executor);
}
@@ -669,6 +670,8 @@ public class ServiceImpl extends Service
for (AbstractFeature af : clientFac.getFeatures()) {
af.initialize(client, bus);
}
+ //CXF-2822
+ initIntercepors(client, clientFac);
if (executor != null) {
client.getEndpoint().setExecutor(executor);
}
@@ -696,4 +699,11 @@ public class ServiceImpl extends Service
features);
}
+
+ private void initIntercepors(Client client, JaxWsClientFactoryBean clientFact) {
+ client.getInInterceptors().addAll(clientFact.getInInterceptors());
+ client.getOutInterceptors().addAll(clientFact.getOutInterceptors());
+ client.getInFaultInterceptors().addAll(clientFact.getInFaultInterceptors());
+ client.getOutFaultInterceptors().addAll(clientFact.getOutFaultInterceptors());
+ }
}
Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java?rev=947948&r1=947947&r2=947948&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java Tue May 25 07:15:51 2010
@@ -19,6 +19,7 @@
package org.apache.cxf.jaxws.dispatch;
import java.net.URL;
+import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
@@ -32,10 +33,16 @@ import javax.xml.ws.soap.SOAPFaultExcept
import org.w3c.dom.Document;
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.jaxws.AbstractJaxWsTest;
+import org.apache.cxf.jaxws.DispatchImpl;
import org.apache.cxf.jaxws.MessageReplayObserver;
import org.apache.cxf.jaxws.ServiceImpl;
+import org.apache.cxf.message.Message;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Destination;
import org.apache.hello_world_soap_http.SOAPService;
@@ -136,4 +143,25 @@ public class DispatchTest extends Abstra
fail("SOAPFaultException was not thrown");
}
+
+ @Test
+ // CXF-2822
+ public void testInterceptorsConfiguration() throws Exception {
+ String cfgFile = "org/apache/cxf/jaxws/dispatch/bus-dispatch.xml";
+ Bus bus = new SpringBusFactory().createBus(cfgFile, true);
+ ServiceImpl service = new ServiceImpl(bus, getClass().getResource("/wsdl/hello_world.wsdl"),
+ serviceName, null);
+
+ Dispatch<Source> disp = service.createDispatch(portName, Source.class, Service.Mode.MESSAGE);
+ List<Interceptor<? extends Message>> interceptors = ((DispatchImpl)disp).getClient()
+ .getInInterceptors();
+ boolean exists = false;
+ for (Interceptor interceptor : interceptors) {
+ if (interceptor instanceof LoggingInInterceptor) {
+ exists = true;
+ }
+ }
+ assertTrue("The LoggingInInterceptor is not configured to dispatch client", exists);
+ }
+
}
Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml?rev=947948&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml (added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml Tue May 25 07:15:51 2010
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd">
+
+ <!--
+ Client-side endpoint. For this example, Alice is the client
+ and Bob is the service.
+ -->
+ <jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort"
+ createdFromAPI="true">
+ <jaxws:inInterceptors>
+ <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+ </jaxws:inInterceptors>
+ </jaxws:client>
+</beans>