in bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java [472:558]
public void validate() throws DeploymentException {
try {
if (definition == null) {
if (wsdl == null) {
throw new DeploymentException("wsdl property must be set");
}
description = DomUtil.parse(wsdl.getInputStream());
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader reader = wsdlFactory.newWSDLReader();
reader.setFeature(Constants.FEATURE_VERBOSE, false);
try {
//ensure the jax-ws-catalog is loaded
OASISCatalogManager.getCatalogManager(getBus()).loadContextCatalogs();
// use wsdl manager to parse wsdl or get cached definition
definition = getBus().getExtension(WSDLManager.class)
.getDefinition(wsdl.getURL());
} catch (WSDLException ex) {
//
}
WSDLServiceFactory factory = new WSDLServiceFactory(getBus(),
definition, 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()));
}
}
ServiceInfo serInfo = new ServiceInfo();
Map<String, Element> schemaList = new HashMap<String, Element>();
SchemaUtil schemaUtil = new SchemaUtil(bus, schemaList);
schemaUtil.getSchemas(definition, serInfo);
serInfo = ei.getService();
List<ServiceInfo> serviceInfos = new ArrayList<ServiceInfo>();
serviceInfos.add(serInfo);
ServiceWSDLBuilder swBuilder = new ServiceWSDLBuilder(getBus(),
serviceInfos);
serInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
serInfo.getInterface().setProperty(WSDLServiceBuilder.WSDL_PORTTYPE, null);
for (OperationInfo opInfo : serInfo.getInterface().getOperations()) {
opInfo.setProperty(WSDLServiceBuilder.WSDL_OPERATION, null);
}
description = WSDLFactory.newInstance().newWSDLWriter()
.getDocument(swBuilder.build());
if (endpoint == null) {
endpoint = ei.getName().getLocalPart();
}
ep = new EndpointImpl(getBus(), cxfService, ei);
this.ep.putAll(this.getProperties());
// init transport
if (locationURI != null) {
ei.setAddress(locationURI.toString());
}
ConduitInitiatorManager conduitMgr = getBus().getExtension(
ConduitInitiatorManager.class);
conduitInit = conduitMgr.getConduitInitiator(ei
.getTransportId());
conduit = conduitInit.getConduit(ei);
CxfBcProviderMessageObserver obs = new CxfBcProviderMessageObserver(this);
conduit.setMessageObserver(obs);
checkWSRMInterceptors();
super.validate();
}
} catch (DeploymentException e) {
throw e;
} catch (Exception e) {
throw new DeploymentException(e);
}
}