in bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java [437:579]
public void validate() throws DeploymentException {
try {
suClassLoader = Thread.currentThread().getContextClassLoader();
if (definition == null) {
retrieveWSDL();
}
if (service == null) {
// looking for the servicename according to targetServiceName
// first
if (definition.getServices().containsKey(getTargetService())) {
service = getTargetService();
} else {
service = (QName) definition.getServices().keySet()
.iterator().next();
}
}
WSDLServiceFactory factory = new WSDLServiceFactory(getBus(),
definition, service);
Service cxfService = factory.create();
ei = cxfService.getServiceInfos().iterator().next()
.getEndpoints().iterator().next();
for (ServiceInfo serviceInfo : cxfService.getServiceInfos()) {
if (serviceInfo.getName().equals(service)
&& getEndpoint() != null
&& serviceInfo.getEndpoint(new QName(serviceInfo
.getName().getNamespaceURI(), getEndpoint())) != null) {
ei = serviceInfo.getEndpoint(new QName(serviceInfo
.getName().getNamespaceURI(), getEndpoint()));
}
}
if (endpoint == null) {
endpoint = ei.getName().getLocalPart();
}
if (locationURI != null) {
ei.setAddress(locationURI);
}
cxfService.getInInterceptors().add(new AbstractPhaseInterceptor<Message>(Phase.PRE_PROTOCOL) {
public void handleMessage(Message message) throws Fault {
if (!started) {
throw new Fault(new Exception("Endpoint is stopped"));
}
}
});
cxfService.getInInterceptors().add(new MustUnderstandInterceptor());
cxfService.getInInterceptors().add(new AttachmentInInterceptor());
cxfService.getInInterceptors().add(new StaxInInterceptor());
cxfService.getInInterceptors().add(WSDLGetInterceptor.INSTANCE);
cxfService.getInInterceptors().add(new OneWayProcessorInterceptor());
cxfService.getInInterceptors().add(
new ReadHeadersInterceptor(getBus()));
cxfService.getInInterceptors().add(
new JbiOperationInterceptor());
cxfService.getInInterceptors().add(
new JbiInWsdl1Interceptor(isUseJBIWrapper(), isUseSOAPEnvelope()));
if (isSchemaValidationEnabled()) {
cxfService.getInInterceptors().add(new SchemaValidationInInterceptor(
isUseJBIWrapper(), isUseSOAPEnvelope()));
}
if (isSchemaValidationEnabled()) {
cxfService.getOutInterceptors().add(new SchemaValidationOutInterceptor(
isUseJBIWrapper(), isUseSOAPEnvelope()));
}
cxfService.getInInterceptors().add(new JbiInInterceptor());
cxfService.getInInterceptors().add(new JbiJAASInterceptor(
AuthenticationService.Proxy.create(
((CxfBcComponent)this.getServiceUnit().getComponent())
.getAuthenticationService()), isX509(), isDelegateToJaas(),
this.jaasDomain));
cxfService.getInInterceptors().add(new JbiInvokerInterceptor());
cxfService.getInInterceptors().add(new JbiPostInvokerInterceptor());
cxfService.getInInterceptors().add(new OutgoingChainInterceptor());
cxfService.getOutInterceptors().add(
new JbiOutWsdl1Interceptor(isUseJBIWrapper(), isUseSOAPEnvelope()));
cxfService.getOutInterceptors().add(
new ExtractHeaderPartIntercepor());
cxfService.getOutInterceptors().add(
new SetSoapVersionInterceptor());
cxfService.getOutInterceptors().add(
new SetStatusInterceptor());
cxfService.getOutInterceptors().add(new AttachmentOutInterceptor());
cxfService.getOutInterceptors().add(
new MtomCheckInterceptor(isMtomEnabled()));
cxfService.getOutInterceptors().add(new StaxOutInterceptor());
/*cxfService.getOutInterceptors().add(
new SoapPreProtocolOutInterceptor());
cxfService.getOutInterceptors().add(
new SoapOutInterceptor(getBus()));*/
cxfService.getOutFaultInterceptors().add(
new SoapOutInterceptor(getBus()));
ep = new EndpointImpl(getBus(), cxfService, ei);
getInInterceptors().addAll(getBus().getInInterceptors());
getInFaultInterceptors().addAll(getBus().getInFaultInterceptors());
getOutInterceptors().addAll(getBus().getOutInterceptors());
getOutFaultInterceptors()
.addAll(getBus().getOutFaultInterceptors());
cxfService.getInInterceptors().addAll(getInInterceptors());
cxfService.getInFaultInterceptors()
.addAll(getInFaultInterceptors());
cxfService.getOutInterceptors().addAll(getOutInterceptors());
cxfService.getOutFaultInterceptors().addAll(
getOutFaultInterceptors());
ep.getInInterceptors().addAll(getInInterceptors());
ep.getInFaultInterceptors().addAll(getInFaultInterceptors());
ep.getOutInterceptors().addAll(getOutInterceptors());
ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
ep.getOutInterceptors().add(new AttachmentOutInterceptor());
ep.getOutInterceptors().add(new StaxOutInterceptor());
ep.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
ep.putAll(this.getProperties());
cxfService.getInInterceptors().addAll(getBus().getInInterceptors());
cxfService.getInFaultInterceptors().addAll(
getBus().getInFaultInterceptors());
cxfService.getOutInterceptors().addAll(
getBus().getOutInterceptors());
cxfService.getOutFaultInterceptors().addAll(
getBus().getOutFaultInterceptors());
chain = new JbiChainInitiationObserver(ep, getBus());
removeDatabindingInterceptprs();
addRMFeatureRequiredInterceptors();
server = new ServerImpl(getBus(), ep, null, chain);
super.validate();
} catch (DeploymentException e) {
throw e;
} catch (Exception e) {
throw new DeploymentException(e);
}
}