Author: barrettj
Date: Thu May 6 15:09:55 2010
New Revision: 941769
URL: http://svn.apache.org/viewvc?rev=941769&view=rev
Log:
Add enforcement of Addressing.required on the client side. Patch submitted by
Katherine Sanders.
Modified:
axis/axis2/java/core/trunk/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
axis/axis2/java/core/trunk/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/AddressingHelperTest.java
Modified:
axis/axis2/java/core/trunk/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
(original)
+++
axis/axis2/java/core/trunk/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
Thu May 6 15:09:55 2010
@@ -65,26 +65,35 @@ public class AddressingValidationHandler
}
/**
- * Check that if the wsaddressing="required" attribute exists on the
service definition or
- * <wsaw:UsingAddressing wsdl:required="true" /> was found in the WSDL
that WS-Addressing
- * headers were found on the inbound message
+ * Check that if the wsaddressing="required" attribute exists on the
service definition
+ * (or AddressingFeature on the client) or <wsaw:UsingAddressing
wsdl:required="true" />
+ * was found in the WSDL (provider side only) that WS-Addressing headers
were found on
+ * the inbound message.
*/
private void checkUsingAddressing(MessageContext msgContext)
throws AxisFault {
+ String addressingFlag;
AxisDescription ad = msgContext.getAxisService();
if (ad == null) {
+ // On client side, get required value from the message context
+ // (set by AddressingConfigurator).
+ // We do not use the UsingAddressing required attribute on the
+ // client side since it is not generated/processed by java tooling.
+ addressingFlag =
AddressingHelper.getAddressingRequirementParemeterValue(msgContext);
if (log.isTraceEnabled()) {
- log.trace("checkUsingAddressing: axisService null, cannot
check UsingAddressing");
+ log.trace("checkUsingAddressing: WSAddressingFlag from
MessageContext=" + addressingFlag);
+ }
+ } else {
+ // On provider side, get required value from AxisOperation
+ // (set by AddressingConfigurator and UsingAddressing WSDL
processing).
+ if(msgContext.getAxisOperation()!=null){
+ ad = msgContext.getAxisOperation();
+ }
+ addressingFlag =
+ AddressingHelper.getAddressingRequirementParemeterValue(ad);
+ if (log.isTraceEnabled()) {
+ log.trace("checkUsingAddressing: WSAddressingFlag from
AxisOperation=" + addressingFlag);
}
- return;
- }
- if(msgContext.getAxisOperation()!=null){
- ad = msgContext.getAxisOperation();
- }
- String addressingFlag =
- AddressingHelper.getAddressingRequirementParemeterValue(ad);
- if (log.isTraceEnabled()) {
- log.trace("checkUsingAddressing: WSAddressingFlag=" +
addressingFlag);
}
if (AddressingConstants.ADDRESSING_REQUIRED.equals(addressingFlag)) {
AddressingFaultsHelper.triggerMessageAddressingRequiredFault(msgContext,
Modified:
axis/axis2/java/core/trunk/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingValidationHandlerTest.java
Thu May 6 15:09:55 2010
@@ -127,4 +127,27 @@ public class AddressingValidationHandler
}
fail("Validated message with missing message ID!");
}
+
+ public void testCheckUsingAdressingOnClient() throws Exception {
+ // Make addressing required using the same property as the
AddressingConfigurator
+ MessageContext mc = new MessageContext();
+ mc.setProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER,
AddressingConstants.ADDRESSING_REQUIRED);
+
+ // Invoke the in handler for a message without addressing headers
+
mc.setConfigurationContext(ConfigurationContextFactory.createEmptyConfigurationContext());
+ StAXSOAPModelBuilder omBuilder =
testUtil.getOMBuilder("addressingDisabledTest.xml");
+ mc.setEnvelope(omBuilder.getSOAPEnvelope());
+ inHandler.invoke(mc);
+
+ // Check the correct exception is thrown by the validation handler
+ try {
+ validationHandler.invoke(mc);
+ fail("An AxisFault should have been thrown due to the absence of
addressing headers.");
+ } catch (AxisFault axisFault) {
+ // Confirm this is the correct fault
+ assertEquals("Wrong fault code",
+ new QName(Final.FAULT_ADDRESSING_HEADER_REQUIRED),
+ axisFault.getFaultCode());
+ }
+ }
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchAddressingFeatureTest.java
Thu May 6 15:09:55 2010
@@ -88,10 +88,12 @@ public class DispatchAddressingFeatureTe
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
String responses = (String)
request.getProperty(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertNull(version);
assertTrue(disabled);
assertNull(responses);
+ assertNull(required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -121,10 +123,12 @@ public class DispatchAddressingFeatureTe
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
String responses = (String)
request.getProperty(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertEquals(Final.WSA_NAMESPACE, version);
assertFalse(disabled);
assertEquals("Wrong default responses",
AddressingConstants.WSAM_INVOCATION_PATTERN_BOTH, responses);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_UNSPECIFIED, required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -155,9 +159,11 @@ public class DispatchAddressingFeatureTe
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertEquals(Final.WSA_NAMESPACE, version);
assertTrue(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_UNSPECIFIED, required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -167,6 +173,43 @@ public class DispatchAddressingFeatureTe
assertNull(epr);
}
+ /*
+ * Test requiring the Addressing feature.
+ */
+ public void testRequiredAddressingFeature() throws Exception {
+ // Set the feature to be required
+ AddressingFeature feature = new AddressingFeature(true, true);
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"),
SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(w3cEPR, Source.class,
Service.Mode.PAYLOAD, feature);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController =
getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String responses = (String)
request.getProperty(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertEquals(Final.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+ assertEquals("Wrong default responses",
AddressingConstants.WSAM_INVOCATION_PATTERN_BOTH, responses);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_REQUIRED, required);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200508,
Final.WSA_NAMESPACE);
+ assertXMLEqual(w3cEPR.toString(), omElement.toString());
+ }
+
// Test configurations that are not allowed with the AddressingFeature
public void testInvalidAddressingFeature() {
// Use the default feature config
Modified:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/dispatch/DispatchSubmissionAddressingFeatureTest.java
Thu May 6 15:09:55 2010
@@ -87,9 +87,11 @@ public class DispatchSubmissionAddressin
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertNull(version);
assertTrue(disabled);
+ assertNull(required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -118,9 +120,11 @@ public class DispatchSubmissionAddressin
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertEquals(Submission.WSA_NAMESPACE, version);
assertFalse(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_UNSPECIFIED, required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -151,9 +155,11 @@ public class DispatchSubmissionAddressin
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertEquals(Submission.WSA_NAMESPACE, version);
assertTrue(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_UNSPECIFIED, required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -163,6 +169,41 @@ public class DispatchSubmissionAddressin
assertNull(epr);
}
+ /*
+ * Test requiring the SubmissionAddressing feature.
+ */
+ public void testRequiredSubmissionAddressingFeature() throws Exception {
+ // Set the feature to be required
+ SubmissionAddressingFeature feature = new
SubmissionAddressingFeature(true, true);
+
+ Service svc = Service.create(new QName("http://test", "TestService"));
+ svc.addPort(new QName("http://test", "TestPort"),
SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+ Dispatch<Source> d = svc.createDispatch(subEPR, Source.class,
Service.Mode.PAYLOAD, feature);
+
+ d.invoke(null);
+
+ TestClientInvocationController testController =
getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertEquals(Submission.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_REQUIRED, required);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200408,
Submission.WSA_NAMESPACE);
+ assertXMLEqual(subEPR.toString(), omElement.toString());
+ }
+
// Test configurations that are not allowed with the
SubmissionAddressingFeature
public void testInvalidSubmissionAddressingFeature() {
// Use the default feature config
Modified:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxyAddressingFeatureTest.java
Thu May 6 15:09:55 2010
@@ -142,7 +142,7 @@ public class ProxyAddressingFeatureTest
* Test disabling the Addressing feature.
*/
public void testDisabledAddressingFeature() {
- // Use the default feature config
+ // Set the feature to be disabled.
AddressingFeature feature = new AddressingFeature(false);
Service svc = Service.create(new QName("http://test",
"ProxyAddressingService"));
@@ -172,6 +172,43 @@ public class ProxyAddressingFeatureTest
}
/*
+ * Test requiring the AddressingFeature.
+ */
+ public void testRequiredAddressingFeature() throws Exception {
+ // Set the feature to be required.
+ AddressingFeature feature = new AddressingFeature(true, true);
+
+ Service svc = Service.create(new QName("http://test",
"ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(w3cEPR,
ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController =
getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String responses = (String)
request.getProperty(AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertEquals(Final.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+ assertEquals("Wrong default responses",
AddressingConstants.WSAM_INVOCATION_PATTERN_BOTH, responses);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_REQUIRED, required);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200508,
Final.WSA_NAMESPACE);
+ assertXMLEqual(w3cEPR.toString(), omElement.toString());
+ }
+
+ /*
* Test the default configuration of the AddressingFeature.
*/
public void testInvalidAddressingFeature() {
Modified:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/client/proxy/ProxySubmissionAddressingFeatureTest.java
Thu May 6 15:09:55 2010
@@ -85,9 +85,11 @@ public class ProxySubmissionAddressingFe
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertNull(version);
assertTrue(disabled);
+ assertNull(required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -116,9 +118,11 @@ public class ProxySubmissionAddressingFe
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertEquals(Submission.WSA_NAMESPACE, version);
assertFalse(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_UNSPECIFIED, required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -149,9 +153,11 @@ public class ProxySubmissionAddressingFe
String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
assertEquals(Submission.WSA_NAMESPACE, version);
assertTrue(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_UNSPECIFIED, required);
org.apache.axis2.context.MessageContext axis2Request =
request.getAxisMessageContext();
@@ -162,6 +168,41 @@ public class ProxySubmissionAddressingFe
}
/*
+ * Test requiring the SubmissionAddressingFeature.
+ */
+ public void testRequiredSubmissionAddressingFeature() throws Exception {
+ // Set the feature to be required.
+ SubmissionAddressingFeature feature = new
SubmissionAddressingFeature(true, true);
+
+ Service svc = Service.create(new QName("http://test",
"ProxyAddressingService"));
+ ProxyAddressingService proxy = svc.getPort(subEPR,
ProxyAddressingService.class, feature);
+ assertNotNull(proxy);
+
+ proxy.doSomething("12345");
+
+ TestClientInvocationController testController =
getInvocationController();
+ InvocationContext ic = testController.getInvocationContext();
+ MessageContext request = ic.getRequestMessageContext();
+
+ String version = (String)
request.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+ Boolean disabled = (Boolean)
request.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ String required = (String)
request.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+
+ assertEquals(Submission.WSA_NAMESPACE, version);
+ assertFalse(disabled);
+ assertEquals("Wrong required attribute",
AddressingConstants.ADDRESSING_REQUIRED, required);
+
+ org.apache.axis2.context.MessageContext axis2Request =
+ request.getAxisMessageContext();
+ org.apache.axis2.addressing.EndpointReference epr =
+ axis2Request.getTo();
+
+ OMElement omElement =
+ EndpointReferenceHelper.toOM(OMF, epr, ELEMENT200408,
Submission.WSA_NAMESPACE);
+ assertXMLEqual(subEPR.toString(), omElement.toString());
+ }
+
+ /*
* Test the default configuration of the SubmissionAddressingFeature.
*/
public void testInvalidSubmissionAddressingFeature() {
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
Thu May 6 15:09:55 2010
@@ -158,7 +158,22 @@ public class AddressingHelper {
value = value.trim();
}
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
- log.debug("getAddressingRequirementParemeterValue: value: '" +
value + "'");
+
log.debug("getAddressingRequirementParemeterValue(AxisDescription): value: '" +
value + "'");
+ }
+ }
+
+ if (value == null || "".equals(value)) {
+ value = AddressingConstants.ADDRESSING_UNSPECIFIED;
+ }
+ return value;
+ }
+
+ public static String getAddressingRequirementParemeterValue(MessageContext
mc){
+ String value = "";
+ if (mc != null) {
+ value =
mc.getProperty(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER).toString();
+ if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+
log.debug("getAddressingRequirementParemeterValue(MessageContext): value: '" +
value + "'");
}
}
Modified:
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/AddressingHelperTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/AddressingHelperTest.java?rev=941769&r1=941768&r2=941769&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/AddressingHelperTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/AddressingHelperTest.java
Thu May 6 15:09:55 2010
@@ -21,6 +21,10 @@ package org.apache.axis2.addressing;
import junit.framework.TestCase;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.description.Parameter;
public class AddressingHelperTest extends TestCase {
@@ -127,4 +131,51 @@ public class AddressingHelperTest extend
mc.setReplyTo(new
EndpointReference(AddressingConstants.Final.WSA_NONE_URI));
assertTrue(AddressingHelper.isSyncFaultAllowed(mc));
}
+
+ public void testGetInvocationPatternParameterValueFromAxisOperation()
throws Exception {
+ AxisService axisService = new AxisService();
+ AxisOperation axisOperation = new InOutAxisOperation();
+ axisService.addOperation(axisOperation);
+
+ // Set invocation pattern on AxisOperation only
+ AddressingHelper.setInvocationPatternParameterValue(axisOperation,
+ AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS);
+
+ String value = AddressingHelper
+ .getInvocationPatternParameterValue(axisOperation);
+ assertEquals(value,
AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS);
+ }
+
+ public void testGetInvocationPatternParameterValueFromAxisService() throws
Exception {
+ AxisService axisService = new AxisService();
+ AxisOperation axisOperation = new InOutAxisOperation();
+ axisService.addOperation(axisOperation);
+
+ // Set invocation pattern on AxisService only
+ axisService.addParameter(new Parameter(
+ AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME,
+ AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS));
+
+ String value = AddressingHelper
+ .getInvocationPatternParameterValue(axisOperation);
+ assertEquals(value,
AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS);
+ }
+
+ public void testGetInvocationPatternParameterValueFromBoth() throws
Exception {
+ AxisService axisService = new AxisService();
+ AxisOperation axisOperation = new InOutAxisOperation();
+ axisService.addOperation(axisOperation);
+
+ // Set invocation pattern on AxisOperation and AxisService
+ AddressingHelper.setInvocationPatternParameterValue(axisOperation,
+ AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS);
+ axisService.addParameter(new Parameter(
+ AddressingConstants.WSAM_INVOCATION_PATTERN_PARAMETER_NAME,
+ AddressingConstants.WSAM_INVOCATION_PATTERN_SYNCHRONOUS));
+
+ // Check that the AxisOperation value has precedence over the
AxisService value
+ String value = AddressingHelper
+ .getInvocationPatternParameterValue(axisOperation);
+ assertEquals(value,
AddressingConstants.WSAM_INVOCATION_PATTERN_ASYNCHRONOUS);
+ }
}