diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-07-05 08:26:12 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2011-07-05 08:26:12 +0000 |
commit | f07051ecf40f234baf3f6b7f897abc0322dda4d4 (patch) | |
tree | 06e59590d442ea69eb911176993cdad9ab9e8d65 /sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java | |
parent | e14213fce7c1427b333d3f19c7bcc362cb020d98 (diff) |
TUSCANY-3881 - Tidy up the binding context and test by re-enabling Rampart support in the ws binding so that WS policy can be applied. For the time being it only demonstrates integrity.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1142920 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java index 6e860752cf..00b3a113fb 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceBindingProvider.java @@ -23,6 +23,7 @@ import java.net.URISyntaxException; import java.util.logging.Logger; import javax.wsdl.Port; +import javax.xml.namespace.QName; import org.apache.axiom.om.OMElement; import org.apache.axis2.AxisFault; @@ -35,6 +36,7 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory; import org.apache.tuscany.sca.host.http.ServletHost; import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.policy.PolicySubject; import org.apache.tuscany.sca.policy.util.PolicyHelper; import org.apache.tuscany.sca.provider.PolicyProvider; import org.apache.tuscany.sca.provider.ServiceBindingProvider; @@ -90,24 +92,18 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem configContext.setContextRoot(servletHost.getContextPath()); // Determine the configuration from the bindings "mayProvides" intents - - isSOAP12Required = PolicyHelper.isIntentRequired(wsBinding, Constants.SOAP12_INTENT); - - isMTOMRequired = PolicyHelper.isIntentRequired(wsBinding, Axis2BindingProviderFactory.MTOM_INTENT); - - // this is not correct as there may be other, custom, policies that - // require rampart. For example this is not going to pick up the case - // of external policy attachment - isRampartRequired = PolicyHelper.isIntentRequired(wsBinding, Constants.AUTHENTICATION_INTENT) || - PolicyHelper.isIntentRequired(wsBinding, Constants.CONFIDENTIALITY_INTENT) || - PolicyHelper.isIntentRequired(wsBinding, Constants.INTEGRITY_INTENT); - - - // Apply the configuration from any other policies - - for (PolicyProvider pp : endpoint.getPolicyProviders()) { - pp.configureBinding(this); - } + // TODO - why don't intents get aggregated to EP correctly? + isSOAP12Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP12_INTENT); + + isMTOMRequired = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Axis2BindingProviderFactory.MTOM_INTENT); + + // if the endpoint contains any WS Policy expressions then we probably need rampart + // TODO - need to take into account Axis configuration policy also + QName wsPolicyQName = new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "Policy"); + if (PolicyHelper.getPolicies(endpoint, wsPolicyQName).size() > 0){ + isRampartRequired = true; + } + // Update port addresses with runtime information // We can safely assume there is only one port here because you configure @@ -142,7 +138,7 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem // Apply the configuration from the mayProvides intents if (isRampartRequired){ - // TODO - do we need to go back to configurator? + Axis2EngineIntegration.loadRampartModule(configContext); } if (isMTOMRequired) { @@ -152,6 +148,7 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem if (isJMSRequired){ // TODO - do we need to go back to configurator? } + wsBinding.setURI(deployedURI); // Check the WSDL style as we only support some of them @@ -178,6 +175,12 @@ public class Axis2ServiceBindingProvider extends Axis2BaseBindingProvider implem public void start() { try { createAxisService(deployedURI, wsdlPort); + + // Apply the configuration from any other policies + + for (PolicyProvider pp : endpoint.getPolicyProviders()) { + pp.configureBinding(this); + } if (deployedURI.startsWith("http://") || deployedURI.startsWith("https://") || |