log.error(Messages.getMessage("errorinscheamgen", e.getMessage()),e);
}
}
// process service description
OMElement descriptionElement =
service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION));
if (descriptionElement != null) {
OMElement descriptionValue = descriptionElement.getFirstElement();
if (descriptionValue != null) {
StringWriter writer = new StringWriter();
descriptionValue.build();
descriptionValue.serialize(writer);
writer.flush();
service.setServiceDescription(writer.toString());
} else {
service.setServiceDescription(descriptionElement.getText());
}
} else {
OMAttribute serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME));
if (serviceNameatt != null) {
service.setServiceDescription(serviceNameatt.getAttributeValue());
}
}
//Setting service tratget namespace if any
OMAttribute targetNameSpace = service_element.
getAttribute(new QName(TARGET_NAME_SPACE));
if (targetNameSpace != null) {
String nameSpeceVale = targetNameSpace.getAttributeValue();
if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
service.setTargetNamespace(nameSpeceVale);
}
}
//Setting schema namespece if any
OMElement scheamElement = service_element.getFirstChildWithName(new QName(SCHEMA));
if (scheamElement != null) {
OMAttribute schemaNameSpace = service_element.
getAttribute(new QName(SCHEMA_NAME_SPACE));
if (schemaNameSpace != null) {
String nameSpeceVale = schemaNameSpace.getAttributeValue();
if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
service.setSchematargetNamespace(nameSpeceVale);
}
}
}
//<schema targetNamespace="http://x.y.z"/>
// setting the PolicyInclude
// processing <wsp:Policy> .. </..> elements
Iterator policyElements = service_element.getChildrenWithName(
new QName(POLICY_NS_URI, TAG_POLICY));
if (policyElements != null) {
processPolicyElements(
PolicyInclude.AXIS_SERVICE_POLICY, policyElements,
service.getPolicyInclude());
}
// processing <wsp:PolicyReference> .. </..> elements
Iterator policyRefElements = service_element.getChildrenWithName(
new QName(POLICY_NS_URI, TAG_POLICY_REF));
if (policyRefElements != null) {
processPolicyRefElements(PolicyInclude.AXIS_SERVICE_POLICY,
policyRefElements, service.getPolicyInclude());
}
//processin Service Scop
String sessionScope = service_element.getAttributeValue(new QName(ATTRIBUTE_SCOPE));
if (sessionScope != null) {
service.setScope(sessionScope);
}
// processing servicewide modules which required to engage gloabally
Iterator moduleRefs = service_element.getChildrenWithName(new QName(TAG_MODULE));
processModuleRefs(moduleRefs);
//processing Default Message receivers
OMElement messageReceiver = service_element.getFirstChildWithName(
new QName(TAG_MESSAGE_RECEIVERS));
if (messageReceiver != null) {
HashMap mrs = processMessageReceivers(service.getClassLoader(), messageReceiver);
Iterator keys = mrs.keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
service.addMessageReceiver(key, (MessageReceiver) mrs.get(key));
}
}
//processing transports
OMElement transports = service_element.getFirstChildWithName(new QName(TAG_TRANSPORTS));
if (transports != null) {
Iterator transport_itr = transports.getChildrenWithName(new QName(TAG_TRANSPORT));
ArrayList trs = new ArrayList();
while (transport_itr.hasNext()) {
OMElement trsEle = (OMElement) transport_itr.next();
trs.add(trsEle.getText());
}
service.setExposeTransports((String[]) trs.toArray(new String[trs.size()]));
}
// processing operations
Iterator operationsIterator =
service_element.getChildrenWithName(new QName(TAG_OPERATION));
ArrayList ops = processOperations(operationsIterator);
for (int i = 0; i < ops.size(); i++) {
AxisOperation operationDesc = (AxisOperation) ops.get(i);
ArrayList wsamappings = operationDesc.getWsamappingList();
if (wsamappings == null) {
continue;
}
for (int j = 0; j < wsamappings.size(); j++) {
String mapping = (String) wsamappings.get(j);
service.mapActionToOperation(mapping, operationDesc);
}
service.addOperation(operationDesc);
}
//Removing exclude operations
OMElement excludeOperations = service_element.getFirstChildWithName(
new QName(TAG_EXCLUDE_OPERATIONS));
if (excludeOperations != null) {
processExcludeOperations(excludeOperations);
}