*/
public void configure(MessageContext messageContext, BindingProvider provider) {
Binding bnd = (Binding) provider.getBinding();
AddressingFeature addressingFeature =
(AddressingFeature) bnd.getFeature(AddressingFeature.ID);
SubmissionAddressingFeature submissionAddressingFeature =
(SubmissionAddressingFeature) bnd.getFeature(SubmissionAddressingFeature.ID);
String addressingNamespace = bnd.getAddressingNamespace();
Boolean disableAddressing =
(Boolean) messageContext.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
//Figure out which WS-Addressing feature was specified causing this configurator to run.
if (addressingFeature != null && submissionAddressingFeature != null) {
//Both features must have been specified.
boolean w3cAddressingEnabled = addressingFeature.isEnabled();
boolean submissionAddressingEnabled = submissionAddressingFeature.isEnabled();
if (w3cAddressingEnabled && submissionAddressingEnabled) {
//Use the addressing namespace of the EPR specified
//via the JAX-WS 2.1 API. If no EPR was specified
//then the 2005/08 namespace will be used.
if (addressingNamespace == null)
addressingNamespace = Final.WSA_NAMESPACE;
disableAddressing = Boolean.FALSE;
}
else if (w3cAddressingEnabled) {
//Enable only 2005/08 addressing
if (Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("FeatureNamespaceNotSupported",
addressingNamespace));
}
addressingNamespace = Final.WSA_NAMESPACE;
disableAddressing = Boolean.FALSE;
}
else if (submissionAddressingEnabled) {
//Enable only 2004/08 addressing
if (Final.WSA_NAMESPACE.equals(addressingNamespace)) {
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("FeatureNamespaceNotSupported",
addressingNamespace));
}
addressingNamespace = Submission.WSA_NAMESPACE;
disableAddressing = Boolean.FALSE;
}
else {
//Disable 2005/08 and 2004/08 addressing
disableAddressing = Boolean.TRUE;
}
}
else if (addressingFeature != null) {
//The AddressingFeature must have been specified.
boolean w3cAddressingEnabled = addressingFeature.isEnabled();
if (w3cAddressingEnabled) {
//Enable 2005/08 addressing
if (Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
throw ExceptionFactory.makeWebServiceException(
Messages.getMessage("FeatureNamespaceNotSupported",
addressingNamespace));
}
addressingNamespace = Final.WSA_NAMESPACE;
disableAddressing = Boolean.FALSE;
}
else {
//Disable 2005/08 addressing
disableAddressing = Boolean.TRUE;
}
}
else if (submissionAddressingFeature != null) {
//The SubmissionAddressingFeature must have been specified.
boolean submissionAddressingEnabled = submissionAddressingFeature.isEnabled();
if (submissionAddressingEnabled) {
//Enable 2004/08 addressing
if (Final.WSA_NAMESPACE.equals(addressingNamespace)) {
throw ExceptionFactory.makeWebServiceException(