* @return
*/
protected BusinessService createBusinessService(QName serviceQName, Definition wsdlDefinition) {
log.debug("Constructing Service UDDI Information for " + serviceQName);
BusinessService service = new BusinessService();
// BusinessKey
service.setBusinessKey(businessKey);
// ServiceKey
service.setServiceKey(UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
// Description
String serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
// Override with the service description from the WSDL if present
if (wsdlDefinition.getService(serviceQName) != null) {
Element docElement = wsdlDefinition.getService(serviceQName).getDocumentationElement();
if (docElement != null && docElement.getTextContent() != null) {
serviceDescription = docElement.getTextContent();
}
}
Description description = new Description();
description.setLang(lang);
description.setValue(serviceDescription);
service.getDescription().add(description);
// Service name
Name sName = new Name();
sName.setLang(lang);
sName.setValue(serviceQName.getLocalPart());
service.getName().add(sName);
CategoryBag categoryBag = new CategoryBag();
String namespace = serviceQName.getNamespaceURI();
if (namespace != null && namespace != "") {
KeyedReference namespaceReference = newKeyedReference(
"uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", namespace);
categoryBag.getKeyedReference().add(namespaceReference);
}
KeyedReference serviceReference = newKeyedReference(
"uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "service");
categoryBag.getKeyedReference().add(serviceReference);
KeyedReference localNameReference = newKeyedReference(
"uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart());
categoryBag.getKeyedReference().add(localNameReference);
service.setCategoryBag(categoryBag);
return service;
}