this.component = (RuntimeComponent)endpointReference.getComponent();
this.reference = (RuntimeComponentReference)endpointReference.getReference();
// A WSDL document should always be present in the binding
if (wsBinding.getGeneratedWSDLDocument() == null) {
throw new ServiceRuntimeException("No WSDL document for " + component.getName() + "/" + reference.getName());
}
// Set to use the Axiom data binding
InterfaceContract contract = wsBinding.getBindingInterfaceContract();
if (contract.getInterface() != null) {
contract.getInterface().resetDataBinding(OMElement.class.getName());
}
// TODO - why don't intents get aggregated to EPR correctly?
isSOAP11Required = PolicyHelper.isIntentRequired((PolicySubject)wsBinding, Constants.SOAP11_INTENT);
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(endpointReference, wsPolicyQName).size() > 0){
isRampartRequired = true;
}
// Validate the configuration for provided policies
// check the WSDL style as we currently only support some of them
if (wsBinding.isRpcEncoded()){
throw new ServiceRuntimeException("rpc/encoded WSDL style not supported. Component " + endpointReference.getComponent().getName() +
" Reference " + endpointReference.getReference() +
" Binding " + endpointReference.getBinding().getName());
}
if (wsBinding.isDocEncoded()){
throw new ServiceRuntimeException("doc/encoded WSDL style not supported. Component " + endpointReference.getComponent().getName() +
" Reference " + endpointReference.getReference() +
" Binding " + endpointReference.getBinding().getName());
}
if (wsBinding.isDocLiteralUnwrapped()){
//throw new ServiceRuntimeException("doc/literal/unwrapped WSDL style not supported for endpoint reference " + endpointReference);
}
// Validate that the WSDL is not using SOAP v1.2 if requires="SOAP.v1_1" has been specified
if ( isSOAP11Required ) {
Definition def = wsBinding.getGeneratedWSDLDocument();
Binding binding = def.getBinding(wsBinding.getBinding().getQName());
for ( Object ext : binding.getExtensibilityElements() ) {
if ( ext instanceof SOAP12Binding )
throw new ServiceRuntimeException("WSDL document is using SOAP v1.2 but SOAP v1.1 " +
"is required by the specified policy intents");
}
}
// Validate that the WSDL is not using SOAP v1.1 if requires="SOAP.v1_2" has been specified
if ( isSOAP12Required ) {
Definition def = wsBinding.getGeneratedWSDLDocument();
Binding binding = def.getBinding(wsBinding.getBinding().getQName());
for ( Object ext : binding.getExtensibilityElements() ) {
if ( ext instanceof SOAPBinding )
throw new ServiceRuntimeException("WSDL document is using SOAP v1.1 but SOAP v1.2 " +
"is required by the specified policy intents");
}
}
}