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/03 11:44:14 UTC
svn commit: r1030398 - in /cxf/trunk:
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/ systests/ws-specs/s...
Author: ema
Date: Wed Nov 3 10:44:13 2010
New Revision: 1030398
URL: http://svn.apache.org/viewvc?rev=1030398&view=rev
Log:
[CXF-3106]:Supported responses configuration in @Addressing;Added jaxws22 tests for this feature
Added:
cxf/trunk/systests/ws-specs/src/test/jaxws22/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java
cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java
cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/
cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl
Modified:
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
cxf/trunk/systests/ws-specs/pom.xml
Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsEndpointImpl.java Wed Nov 3 10:44:13 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/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java Wed Nov 3 10:44:13 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/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Wed Nov 3 10:44:13 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/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Messages.properties Wed Nov 3 10:44:13 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/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/Names.java Wed Nov 3 10:44:13 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/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java (original)
+++ cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/WSAddressingFeature.java Wed Nov 3 10:44:13 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/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java (original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/HelloImpl.java Wed Nov 3 10:44:13 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/trunk/systests/ws-specs/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/pom.xml?rev=1030398&r1=1030397&r2=1030398&view=diff
==============================================================================
--- cxf/trunk/systests/ws-specs/pom.xml (original)
+++ cxf/trunk/systests/ws-specs/pom.xml Wed Nov 3 10:44:13 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>
Added: cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java?rev=1030398&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Hello.java Wed Nov 3 10:44:13 2010
@@ -0,0 +1,31 @@
+/**
+ * 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_responses;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@SOAPBinding(use = SOAPBinding.Use.LITERAL)
+@WebService(name = "Hello", targetNamespace = "http://cxf.apache.org/systest/wsa/responses")
+public interface Hello {
+ @SOAPBinding(style = SOAPBinding.Style.RPC)
+ @WebMethod(operationName = "sayHi", exclude = false)
+ String sayHi(String value);
+}
Added: cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java?rev=1030398&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloImpl.java Wed Nov 3 10:44:13 2010
@@ -0,0 +1,34 @@
+/**
+ * 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_responses;
+import javax.jws.WebService;
+import javax.xml.ws.soap.Addressing;
+import javax.xml.ws.soap.AddressingFeature.Responses;
+
+
+@WebService(name = "Hello", serviceName = "HelloService", portName = "HelloPort",
+ targetNamespace = "http://cxf.apache.org/systest/wsa/responses",
+ endpointInterface = "org.apache.cxf.systest.ws.addr_responses.Hello")
+@Addressing(responses = Responses.NON_ANONYMOUS)
+public class HelloImpl implements Hello {
+ public String sayHi(String arg0) {
+ return "get" + arg0;
+ }
+
+}
Added: cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java?rev=1030398&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/HelloService.java Wed Nov 3 10:44:13 2010
@@ -0,0 +1,43 @@
+/**
+ * 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_responses;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+@WebServiceClient(name = "HelloService",
+ targetNamespace = "http://cxf.apache.org/systest/wsa/responses")
+public class HelloService extends Service {
+ static final QName SERVICE = new QName("http://cxf.apache.org/systest/wsa/responses", "HelloService");
+ static final QName HELLO_PORT =
+ new QName("http://cxf.apache.org/systest/wsa/responses", "HelloPort");
+ public HelloService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ @WebEndpoint(name = "HelloPort")
+ public Hello getHelloPort() {
+ return (Hello)super.getPort(HELLO_PORT, Hello.class);
+ }
+
+}
Added: cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java?rev=1030398&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/Server.java Wed Nov 3 10:44:13 2010
@@ -0,0 +1,58 @@
+/**
+ * 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_responses;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class Server extends AbstractBusTestServerBase {
+ static final String PORT = allocatePort(Server.class);
+ protected void run() {
+ Object implementor = new HelloImpl();
+ String address = "http://localhost:" + PORT + "/wsa/responses";
+ EndpointImpl ep = new EndpointImpl(BusFactory.getThreadDefaultBus(),
+ implementor,
+ null,
+ getWsdl());
+ ep.publish(address);
+ }
+
+ public static void main(String[] args) {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+ private String getWsdl() {
+ try {
+ java.net.URL wsdl = getClass().getResource("/wsdl_systest_responses/responses.wsdl");
+ return wsdl.toString();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
Added: cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java?rev=1030398&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java (added)
+++ cxf/trunk/systests/ws-specs/src/test/jaxws22/org/apache/cxf/systest/ws/addr_responses/WSAResponsesClientServerTest.java Wed Nov 3 10:44:13 2010
@@ -0,0 +1,67 @@
+/**
+ * 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_responses;
+
+import java.io.ByteArrayOutputStream;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.cxf.systest.ws.AbstractWSATestBase;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WSAResponsesClientServerTest extends AbstractWSATestBase {
+ static final String PORT = allocatePort(Server.class);
+ @Before
+ public void setUp() throws Exception {
+ createBus();
+ }
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue("server did not launch correctly", launchServer(Server.class, true));
+ }
+
+ @Test
+ public void testWSAResponses() throws Exception {
+ ByteArrayOutputStream bin = this.setupInLogging();
+ ByteArrayOutputStream bout = this.setupOutLogging();
+ URL wsdlURL = new URL("http://localhost:" + PORT + "/wsa/responses?wsdl");
+ QName serviceQName = new QName("http://cxf.apache.org/systest/wsa/responses", "HelloService");
+ HelloService service = new HelloService(wsdlURL, serviceQName);
+ try {
+ service.getHelloPort().sayHi("helloWorld");
+ fail("Expect exception");
+ } catch (Exception e) {
+ String expectedDetail = "A header representing a Message Addressing Property is not valid";
+ if (e instanceof SOAPFaultException) {
+ assertTrue("Expect fault deail : " + expectedDetail ,
+ e.getMessage().indexOf(expectedDetail) > -1);
+ } else {
+ throw e;
+ }
+
+ }
+ }
+
+}
Added: cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl?rev=1030398&view=auto
==============================================================================
--- cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl (added)
+++ cxf/trunk/systests/ws-specs/src/test/resources/wsdl_systest_responses/responses.wsdl Wed Nov 3 10:44:13 2010
@@ -0,0 +1,55 @@
+<?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.
+-->
+<wsdl:definitions name="HelloService" targetNamespace="http://cxf.apache.org/systest/wsa/responses" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cxf.apache.org/systest/wsa/responses" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:message name="sayHiResponse">
+ <wsdl:part name="return" type="xsd:string">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="sayHi">
+ <wsdl:part name="arg0" type="xsd:string">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="Hello">
+ <wsdl:operation name="sayHi">
+ <wsdl:input message="tns:sayHi" name="sayHi">
+ </wsdl:input>
+ <wsdl:output message="tns:sayHiResponse" name="sayHiResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloServiceSoapBinding" type="tns:Hello">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsaw:UsingAddressing wsdl:required="false"/>
+ <wsdl:operation name="sayHi">
+ <soap:operation soapAction="" style="rpc"/>
+ <wsdl:input name="sayHi">
+ <soap:body namespace="http://cxf.apache.org/systest/wsa/responses" use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="sayHiResponse">
+ <soap:body namespace="http://cxf.apache.org/systest/wsa/responses" use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloService">
+ <wsdl:port binding="tns:HelloServiceSoapBinding" name="HelloPort">
+ <soap:address location="http://localhost:9000/wsa/responses"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>