You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/01/23 20:55:39 UTC
svn commit: r1234954 - in /cxf/trunk:
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/
rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/
rt/core/src/main/java/org/apache/cxf/endpoint/
systests/ws-specs/src/test/java/org...
Author: dkulp
Date: Mon Jan 23 19:55:38 2012
New Revision: 1234954
URL: http://svn.apache.org/viewvc?rev=1234954&view=rev
Log:
[CXF-4056, CXF-4057] Fix a couple of issues with echoed WS-Addressing
headers and faults causing clients to hang until a timeout.
Added:
cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java (with props)
Modified:
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderOutFilterInterceptor.java
cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/Server.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=1234954&r1=1234953&r2=1234954&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 Mon Jan 23 19:55:38 2012
@@ -393,7 +393,7 @@ public class SoapBindingFactory extends
sb.getOutInterceptors().add(new AttachmentOutInterceptor());
sb.getOutInterceptors().add(new StaxOutInterceptor());
- sb.getOutInterceptors().add(new SoapHeaderOutFilterInterceptor());
+ sb.getOutInterceptors().add(SoapHeaderOutFilterInterceptor.INSTANCE);
if (SoapBindingConstants.BINDING_STYLE_RPC.equalsIgnoreCase(bindingStyle)) {
sb.getInInterceptors().add(new RPCInInterceptor());
@@ -421,6 +421,7 @@ public class SoapBindingFactory extends
sb.getOutInterceptors().add(new SoapPreProtocolOutInterceptor());
sb.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
sb.getOutFaultInterceptors().add(new SoapOutInterceptor(getBus()));
+ sb.getOutFaultInterceptors().add(SoapHeaderOutFilterInterceptor.INSTANCE);
// 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
Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderOutFilterInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderOutFilterInterceptor.java?rev=1234954&r1=1234953&r2=1234954&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderOutFilterInterceptor.java (original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderOutFilterInterceptor.java Mon Jan 23 19:55:38 2012
@@ -27,6 +27,7 @@ import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.Phase;
public class SoapHeaderOutFilterInterceptor extends AbstractSoapInterceptor {
+ public static final SoapHeaderOutFilterInterceptor INSTANCE = new SoapHeaderOutFilterInterceptor();
public SoapHeaderOutFilterInterceptor() {
super(Phase.PRE_LOGICAL);
Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=1234954&r1=1234953&r2=1234954&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Mon Jan 23 19:55:38 2012
@@ -823,7 +823,8 @@ public class ClientImpl
} finally {
BusFactory.setThreadDefaultBus(origBus);
synchronized (message.getExchange()) {
- if (!isPartialResponse(message)) {
+ if (!isPartialResponse(message)
+ || message.getContent(Exception.class) != null) {
message.getExchange().put(FINISHED, Boolean.TRUE);
message.getExchange().setInMessage(message);
message.getExchange().notifyAll();
Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java?rev=1234954&r1=1234953&r2=1234954&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/WSAFromJavaTest.java Mon Jan 23 19:55:38 2012
@@ -24,6 +24,7 @@ import java.net.URL;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.soap.SOAPFaultException;
+import org.apache.cxf.feature.LoggingFeature;
import org.apache.cxf.systest.ws.AbstractWSATestBase;
import org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImpl;
import org.apache.cxf.systest.ws.addr_fromjava.client.AddNumberImplService;
@@ -43,7 +44,7 @@ public class WSAFromJavaTest extends Abs
@BeforeClass
public static void startServers() throws Exception {
- assertTrue("server did not launch correctly", launchServer(Server.class));
+ assertTrue("server did not launch correctly", launchServer(Server.class, true));
}
@Test
@@ -171,4 +172,23 @@ public class WSAFromJavaTest extends Abs
assertTrue(e.getMessage().contains("Unexpected wrapper"));
}
}
+
+ @Test
+ public void testFaultFromNonAddressService() throws Exception {
+ new LoggingFeature().initialize(this.getBus());
+ AddNumberImpl port = getPort();
+ java.util.Map<String, Object> requestContext = ((BindingProvider)port).getRequestContext();
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ "http://localhost:" + PORT + "/AddNumberImplPort-noaddr");
+
+ long start = System.currentTimeMillis();
+ port.addNumbers(1, 2);
+ try {
+ port.addNumbers3(-1, -1);
+ } catch (Exception ex) {
+ //ignore, expected
+ }
+ long end = System.currentTimeMillis();
+ assertTrue((end - start) < 50000);
+ }
}
\ No newline at end of file
Added: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java?rev=1234954&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java Mon Jan 23 19:55:38 2012
@@ -0,0 +1,52 @@
+/**
+ * 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.systest.ws.addr_fromjava.server;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public class AddNumberImplNoAddr {
+ public int addNumbers(int number1, int number2) throws AddNumbersException {
+ return execute(number1, number2);
+ }
+
+ public int addNumbers2(int number1, int number2) {
+ return number1 + number2;
+ }
+
+ @WebMethod(action = "http://cxf.apache.org/input3")
+ public int addNumbers3(int number1, int number2) throws AddNumbersException {
+ return execute(number1, number2);
+ }
+
+ @WebMethod(action = "http://cxf.apache.org/input4")
+ public int addNumbers4(int number1, int number2) throws AddNumbersException {
+ return number1 + number2;
+ }
+
+ int execute(int number1, int number2) throws AddNumbersException {
+ if (number1 < 0 || number2 < 0) {
+ throw new AddNumbersException("Negative numbers can't be added!",
+ "Numbers: " + number1 + ", " + number2);
+ }
+ return number1 + number2;
+ }
+}
Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/AddNumberImplNoAddr.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/Server.java?rev=1234954&r1=1234953&r2=1234954&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/Server.java (original)
+++ cxf/trunk/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/addr_fromjava/server/Server.java Mon Jan 23 19:55:38 2012
@@ -29,11 +29,13 @@ public class Server extends AbstractBusT
protected void run() {
Object implementor = new AddNumberImpl();
String address = "http://localhost:" + PORT + "/AddNumberImplPort";
-
EndpointImpl ep = new EndpointImpl(implementor);
-
ep.getFeatures().add(new WSAddressingFeature());
ep.publish(address);
+
+ ep = new EndpointImpl(new AddNumberImplNoAddr());
+ ep.publish(address + "-noaddr");
+
}
public static void main(String[] args) {