OMElement wsdlElement = epConfig.getFirstChildWithName
(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "wsdl"));
if (wsdlElement != null) {
DefinitionFactory fac = getEndpointDefinitionFactory();
EndpointDefinition endpoint;
if (fac == null) {
fac = new EndpointDefinitionFactory();
endpoint = fac.createDefinition(wsdlElement);
} else {
endpoint = fac.createDefinition(wsdlElement);
}
// for now, QOS information has to be provided explicitly.
extractSpecificEndpointProperties(endpoint, wsdlElement);
wsdlEndpoint.setDefinition(endpoint);
processAuditStatus(endpoint, wsdlEndpoint.getName(), wsdlElement);
// get the service name and port name. at this point we should not worry about
// the presence of those parameters. they are handled by corresponding WSDL builders.
String serviceName = wsdlElement.getAttributeValue(new QName("service"));
String portName = wsdlElement.getAttributeValue(new QName("port"));
// check if wsdl is supplied as a URI
String wsdlURI = wsdlElement.getAttributeValue(new QName("uri"));
// set serviceName and portName in the endpoint. it does not matter if these are
// null at this point. we are setting them only for serialization purpose.
wsdlEndpoint.setServiceName(serviceName);
wsdlEndpoint.setPortName(portName);
String noParsing = properties.getProperty(SKIP_WSDL_PARSING);
if (wsdlURI != null) {
wsdlEndpoint.setWsdlURI(wsdlURI.trim());
if (noParsing == null || !JavaUtils.isTrueExplicitly(noParsing)) {
try {
OMNode wsdlOM = SynapseConfigUtils.getOMElementFromURL(new URL(wsdlURI)
.toString(), properties.get(SynapseConstants.SYNAPSE_HOME) != null ?
properties.get(SynapseConstants.SYNAPSE_HOME).toString() : "");
if (wsdlOM != null && wsdlOM instanceof OMElement) {
OMElement omElement = (OMElement) wsdlOM;
OMNamespace ns = omElement.getNamespace();
if (ns != null) {
String nsUri = omElement.getNamespace().getNamespaceURI();
if (org.apache.axis2.namespace.Constants.NS_URI_WSDL11.equals(nsUri)) {
new WSDL11EndpointBuilder().
populateEndpointDefinitionFromWSDL(endpoint,
wsdlURI.trim(), omElement, serviceName, portName);
} else if (WSDL2Constants.WSDL_NAMESPACE.equals(nsUri)) {
//endpoint = new WSDL20EndpointBuilder().
// createEndpointDefinitionFromWSDL(wsdlURI, serviceName, portName);
handleException("WSDL 2.0 Endpoints are currently not supported");
}
}
}
} catch (Exception e) {
handleException("Couldn't create endpoint from the given WSDL URI : "
+ e.getMessage(), e);
}
}
}
// check if the wsdl 1.1 document is supplied inline
OMElement definitionElement = wsdlElement.getFirstChildWithName
(new QName(org.apache.axis2.namespace.Constants.NS_URI_WSDL11, "definitions"));
if (endpoint == null && definitionElement != null) {
wsdlEndpoint.setWsdlDoc(definitionElement);
if (noParsing == null || !JavaUtils.isTrueExplicitly(noParsing)) {
String resolveRoot = properties.get(SynapseConstants.RESOLVE_ROOT).toString();
String baseUri = "file:./";
if (resolveRoot != null) {
baseUri = resolveRoot.trim();
}
if (!baseUri.endsWith(File.separator)) {
baseUri = baseUri + File.separator;
}
new WSDL11EndpointBuilder().populateEndpointDefinitionFromWSDL(endpoint,
baseUri, definitionElement, serviceName, portName);
} else {
endpoint = new EndpointDefinition();
}
}
// check if a wsdl 2.0 document is supplied inline
OMElement descriptionElement = wsdlElement.getFirstChildWithName