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/11/04 05:50:12 UTC
svn commit: r1030834 - in /cxf/branches/2.3.x-fixes:
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/
rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/
systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/
systests/ws-specs/ syst...
Author: ema
Date: Thu Nov 4 04:50:11 2010
New Revision: 1030834
URL: http://svn.apache.org/viewvc?rev=1030834&view=rev
Log:
Merged revisions 1030398 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1030398 | ema | 2010-11-03 18:44:13 +0800 (Wed, 03 Nov 2010) | 1 line
[CXF-3106]:Supported responses configuration in @Addressing;Added jaxws22 tests for this feature
........
Added:
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java
- copied unchanged from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java
- copied unchanged from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java
- copied unchanged from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java
- copied unchanged from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java
- copied unchanged from r1030398, cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_responses/
- copied from r1030398, cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/
cxf/branches/2.3.x-fixes/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl
- copied unchanged from r1030398, cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl
Modified:
cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
cxf/branches/2.3.x-fixes/systests/ws-specs/pom.xml
Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Thu Nov 4 04:50:11 2010
@@ -19,9 +19,11 @@
package org.apache.cxf.jaxws.support;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.ExtensionRegistry;
import javax.wsdl.extensions.UnknownExtensibilityElement;
@@ -43,6 +45,7 @@ import org.apache.cxf.binding.soap.SoapB
import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
import org.apache.cxf.binding.xml.XMLBinding;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
import org.apache.cxf.endpoint.EndpointException;
import org.apache.cxf.endpoint.EndpointImpl;
import org.apache.cxf.feature.AbstractFeature;
@@ -67,6 +70,7 @@ import org.apache.cxf.jaxws.interceptors
import org.apache.cxf.jaxws.interceptors.SwAOutInterceptor;
import org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor;
import org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor;
+import org.apache.cxf.jaxws.spi.ProviderImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.BindingInfo;
@@ -382,6 +386,17 @@ public class JaxWsEndpointImpl extends E
addAddressingFeature(feature);
}
feature.setAddressingRequired(addressing.isRequired());
+ if (ProviderImpl.isJaxWs22()) {
+ try {
+ Class<?> addrClass = ClassLoaderUtils.loadClass("javax.xml.ws.soap.AddressingFeature",
+ ProviderImpl.class);
+ Method responsesMethod = addrClass.getMethod("getResponses", new Class[] {});
+ Object responses = responsesMethod.invoke(addressing, new Object[] {});
+ feature.setResponses(responses.toString());
+ } catch (Exception e) {
+ // ignore
+ }
+ }
} else {
removeAddressingFeature();
getEndpointInfo().setProperty("org.apache.cxf.ws.addressing.MAPAggregator.addressingDisabled",
Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Thu Nov 4 04:50:11 2010
@@ -67,6 +67,7 @@ import org.apache.cxf.jaxws.JAXWSMethodD
import org.apache.cxf.jaxws.JAXWSProviderMethodDispatcher;
import org.apache.cxf.jaxws.WrapperClassGenerator;
import org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor;
+import org.apache.cxf.jaxws.spi.ProviderImpl;
import org.apache.cxf.service.factory.AbstractServiceConfiguration;
import org.apache.cxf.service.factory.FactoryBeanListener;
import org.apache.cxf.service.factory.FactoryBeanListener.Event;
@@ -166,7 +167,24 @@ public class JaxWsServiceFactoryBean ext
}
if (addressing != null) {
- features.add(new AddressingFeature(addressing.enabled(), addressing.required()));
+ if (ProviderImpl.isJaxWs22()) {
+ try {
+ Method method = Addressing.class.getMethod("responses", new Class<?>[]{});
+ Object responses = method.invoke(addressing, new Object[]{});
+ java.lang.reflect.Constructor<?> constructor =
+ AddressingFeature.class.getConstructor(new Class[] {
+ boolean.class, boolean.class, responses.getClass()
+ });
+ Object obj = constructor.newInstance(addressing.enabled(), addressing.required(),
+ responses);
+ features.add((WebServiceFeature)obj);
+ } catch (Exception e) {
+ features.add(new AddressingFeature(addressing.enabled(), addressing.required()));
+ }
+ } else {
+ features.add(new AddressingFeature(addressing.enabled(), addressing.required()));
+ }
+
}
if (features.size() > 0) {
Modified: cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Thu Nov 4 04:50:11 2010
@@ -118,6 +118,8 @@ public class MAPAggregator extends Abstr
private boolean allowDuplicates = true;
+ private String addressingResponses = "ALL";
+
/**
* Constructor.
*/
@@ -183,6 +185,14 @@ public class MAPAggregator extends Abstr
}
/**
+ * Sets Addresing Response
+ *
+ */
+ public void setAddressingResponses(String responses) {
+ addressingResponses = responses;
+ }
+
+ /**
* Returns the cache used to enforce duplicate message IDs when
* {@link #allowDuplicates()} returns {@code false}.
*
@@ -510,10 +520,12 @@ public class MAPAggregator extends Abstr
theMaps.getReplyTo(),
theMaps.getFaultTo());
}
- } else if (!ContextUtils.isRequestor(message)) {
+ } else if (!ContextUtils.isRequestor(message)) {
//responder validates incoming MAPs
AddressingPropertiesImpl maps = getMAPs(message, false, false);
+ //check responses
if (maps != null) {
+ checkAddressingResponses(maps.getReplyTo(), maps.getFaultTo());
assertAddressing(message,
maps.getReplyTo(),
maps.getFaultTo());
@@ -610,6 +622,29 @@ public class MAPAggregator extends Abstr
return continueProcessing;
}
+ private void checkAddressingResponses(EndpointReferenceType replyTo, EndpointReferenceType faultTo) {
+ if (this.addressingResponses.equals("ALL")) {
+ return;
+ }
+ boolean passed = false;
+ boolean anonReply = ContextUtils.isGenericAddress(replyTo);
+ boolean anonFault = ContextUtils.isGenericAddress(faultTo);
+ boolean isAnonymous = anonReply && anonFault;
+ if ("ANONYMOUS".equals(addressingResponses) && isAnonymous) {
+ passed = true;
+ } else if ("NON_ANONYMOUS".equals(addressingResponses)
+ && (!anonReply && (faultTo.getAddress() != null && !anonFault)
+ || !anonReply && faultTo.getAddress() == null)) {
+ passed = true;
+ }
+ if (!passed) {
+ String reason = BUNDLE.getString("INVALID_ADDRESSING_PROPERTY_MESSAGE");
+ QName detail = "ANONYMOUS".equals(addressingResponses)
+ ? Names.ONLY_ANONYMOUS_ADDRESS_SUPPORTED_QNAME
+ : Names.ONLY_NONANONYMOUS_ADDRESS_SUPPORTED_QNAME;
+ throw new SoapFault(reason, detail);
+ }
+ }
/**
* Perform MAP aggregation.
*
@@ -1141,7 +1176,7 @@ public class MAPAggregator extends Abstr
&& !sa.equals(action)) {
//don't match, must send fault back....
String reason =
- BUNDLE.getString("INVALID_SOAPACTION_MESSAGE");
+ BUNDLE.getString("INVALID_ADDRESSING_PROPERTY_MESSAGE");
ContextUtils.storeMAPFaultName(Names.ACTION_MISMATCH_NAME,
message);
Modified: cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties Thu Nov 4 04:50:11 2010
@@ -25,5 +25,5 @@ ENDPOINT_UNAVAILABLE_MSG = Endpoint {0}
INVALID_MAP_MSG = Invalid Message Addressing Property {0}
MAP_REQUIRED_MSG = Message Addressing Property {0} required
DUPLICATE_MESSAGE_ID_MSG = Duplicate Message ID {0}
-INVALID_SOAPACTION_MESSAGE = A header representing a Message Addressing Property is not valid and the message cannot be processed
+INVALID_ADDRESSING_PROPERTY_MESSAGE = A header representing a Message Addressing Property is not valid and the message cannot be processed
MISSING_ACTION_MESSAGE = A required header representing a Message Addressing Property is not present
\ No newline at end of file
Modified: cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java Thu Nov 4 04:50:11 2010
@@ -158,7 +158,16 @@ public final class Names {
public static final QName HEADER_REQUIRED_QNAME =
new QName(WSA_NAMESPACE_NAME, HEADER_REQUIRED_NAME);
-
+ public static final String ONLY_ANONYMOUS_ADDRESS_SUPPORTED_NAME =
+ "OnlyAnonymousAddressSupported";
+ public static final QName ONLY_ANONYMOUS_ADDRESS_SUPPORTED_QNAME =
+ new QName(WSA_NAMESPACE_NAME, ONLY_ANONYMOUS_ADDRESS_SUPPORTED_NAME);
+
+ public static final String ONLY_NONANONYMOUS_ADDRESS_SUPPORTED_NAME =
+ "OnlyNonAnonymousAddressSupported";
+ public static final QName ONLY_NONANONYMOUS_ADDRESS_SUPPORTED_QNAME =
+ new QName(WSA_NAMESPACE_NAME, ONLY_NONANONYMOUS_ADDRESS_SUPPORTED_NAME);
+
public static final String SOAP11HTTP_ADDRESSING_BINDING =
"http://schemas.xmlsoap.org/soap/envelope/?addressing=ms";
public static final String SOAP12HTTP_ADDRESSING_BINDING =
Modified: cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java (original)
+++ cxf/branches/2.3.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java Thu Nov 4 04:50:11 2010
@@ -26,7 +26,6 @@ import org.apache.cxf.ws.addressing.soap
@NoJSR250Annotations
public class WSAddressingFeature extends AbstractFeature {
-
private MAPAggregator mapAggregator = new MAPAggregator();
private MAPCodec mapCodec = new MAPCodec();
@@ -90,4 +89,8 @@ public class WSAddressingFeature extends
public void setMessageIdCache(MessageIdCache messageIdCache) {
mapAggregator.setMessageIdCache(messageIdCache);
}
+
+ public void setResponses(String responses) {
+ mapAggregator.setAddressingResponses(responses);
+ }
}
Modified: cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java (original)
+++ cxf/branches/2.3.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java Thu Nov 4 04:50:11 2010
@@ -21,7 +21,7 @@ import javax.jws.WebService;
@WebService(name = "Hello", serviceName = "HelloService", portName = "HelloPort",
- targetNamespace = "http://cxf.apache.org/systest/jaxws/",
+ targetNamespace = "http://cxf.apache.org/systest/wsa/responses",
endpointInterface = "org.apache.cxf.systest.jaxws.Hello")
public class HelloImpl implements Hello {
public String sayHi(String arg0) {
Modified: cxf/branches/2.3.x-fixes/systests/ws-specs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/systests/ws-specs/pom.xml?rev=1030834&r1=1030833&r2=1030834&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/systests/ws-specs/pom.xml (original)
+++ cxf/branches/2.3.x-fixes/systests/ws-specs/pom.xml Thu Nov 4 04:50:11 2010
@@ -197,5 +197,82 @@
<properties>
<cxf.surefire.fork.mode>pertest</cxf.surefire.fork.mode>
</properties>
+ <profiles>
+ <profile>
+ <id>jaxws22</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxws_2.2_spec</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <properties>
+ <cxf.spi-dir>spi-2.2</cxf.spi-dir>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-jaxws22-test-source</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/src/test/jaxws22</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-endorsed-dir</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jaxws_2.2_spec</artifactId>
+ <outputDirectory>${basedir}/target/endorsed</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArguments>
+ <endorseddirs>${basedir}/target/endorsed</endorseddirs>
+ </compilerArguments>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Djava.endorsed.dirs=${basedir}/target/endorsed</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>