binding = (org.apache.axis2.jaxws.spi.Binding) BindingUtils.createBinding(endpointDesc);
if(log.isDebugEnabled()){
log.debug("Lookign for Handler Resolver");
}
// TODO should we allow the ServiceDelegate to figure out the default handlerresolver? Probably yes, since a client app may look for one there.
HandlerResolver handlerResolver = null;
if(serviceDelegate.getHandlerResolver() != null){
if(log.isDebugEnabled()){
log.debug("Reading default Handler Resolver ");
}
handlerResolver = serviceDelegate.getHandlerResolver();
}
else{
handlerResolver = new HandlerResolverImpl(endpointDesc.getServiceDescription(), serviceDelegate);
if(log.isDebugEnabled()){
log.debug("Creating new Handler Resolver using HandlerResolverImpl");
}
}
// See if the metadata from creating the service indicates that MTOM should be enabled
if (binding instanceof SOAPBinding) {
// MTOM can be enabled either at the ServiceDescription level (via the WSDL binding type) or
// at the EndpointDescription level via the binding type used to create a Dispatch.
boolean enableMTOMFromMetadata = false;
// if we have an SEI for the port, then we'll use it in order to search for MTOM configuration
if(endpointDesc.getEndpointInterfaceDescription() != null
&&
endpointDesc.getEndpointInterfaceDescription().getSEIClass() != null) {
enableMTOMFromMetadata = endpointDesc.getServiceDescription().isMTOMEnabled(serviceDelegate,
endpointDesc.getEndpointInterfaceDescription().getSEIClass());
}
else {
enableMTOMFromMetadata = endpointDesc.getServiceDescription().isMTOMEnabled(serviceDelegate);
}
if (!enableMTOMFromMetadata) {
String bindingType = endpointDesc.getClientBindingID();
enableMTOMFromMetadata = (bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING));
}
if (enableMTOMFromMetadata) {
((SOAPBinding) binding).setMTOMEnabled(true);
}
}
// check for properties that need to be set on the BindingProvider
String seiName = null;
if(endpointDesc.getEndpointInterfaceDescription() != null
&&
endpointDesc.getEndpointInterfaceDescription().getSEIClass() != null) {
seiName = endpointDesc.getEndpointInterfaceDescription().getSEIClass().getName();
}
String portQNameString = endpointDesc.getPortQName().toString();
String key = seiName + ":" + portQNameString;
Map<String, Object> bProps = endpointDesc.getServiceDescription().getBindingProperties(serviceDelegate, key);
if(bProps != null) {
if(log.isDebugEnabled()) {
log.debug("Setting binding props with size: " + bProps.size() + " on " +
"BindingProvider RequestContext");
}
requestContext.putAll(bProps);
}
binding.setHandlerChain(handlerResolver.getHandlerChain(endpointDesc.getPortInfo()));
//Set JAX-WS 2.1 related properties.
try {
binding.setAxis2EndpointReference(epr);
binding.setAddressingNamespace(addressingNamespace);