// Instantiate Metadata instance to build the WS-Mex Metadata element
SOAPEnvelope envelope = msgContext.getEnvelope();
String soapNamespaceURI = envelope.getNamespace().getNamespaceURI();
SOAPFactory factory = MexUtil.getSOAPFactory(soapNamespaceURI);
Metadata metadata = new Metadata(factory, mexNamespaceValue);
DataRetrievalRequest requestOptions = new DataRetrievalRequest();
String identifier_value = null;
// Check if Identifier element included in request
OMElement dialectElem = aReq.getFirstChildWithName(new QName(
mexNamespaceValue, MexConstants.SPEC.DIALECT));
if (dialectElem != null) {
OMElement identifier = dialectElem.getFirstChildWithName(new QName(
mexNamespaceValue, MexConstants.SPEC.IDENTIFIER));
if (identifier != null) {
identifier_value = identifier.getText();
if (identifier_value != null && identifier_value.length() > 0) {
requestOptions.putIdentifier(identifier_value);
}
}
}
// Process the request and append MetadataSection to Metadata
// Loop through the metadata_request_list for Dialect(s)), and setup requestOptions.
// Basically, one requestOptions is setup for each supported outputForm for the Dialect
// and Identifier specified in the GetMetadata request.
int len = metadata_request_list.size();
OutputForm[] outputforms;
for (int i = 0; i < len; i++) { // metadata request
String dialect = "";
try {
dialect = (String) metadata_request_list.get(i);
requestOptions.putDialect(dialect);
outputforms = MexUtil.determineOutputForm(dialect, axisConfigMEXParm, serviceConfigMEXParm);
// Loop to call AxisService::getData API to retrieve data
// for the Dialect and Identifier(if specified) in the request
// for each
// supported output form.
for (int j = 0; j < outputforms.length; j++) { // output form
requestOptions.putOutputForm(outputforms[j]);
Data[] result = msgContext.getAxisService().getData(requestOptions,
msgContext);
ArrayList sections = processData(result, outputforms[j], dialect,
identifier_value, factory);
metadata.addMetadatSections(sections);
}
} catch (DataRetrievalException e) {
log.error("Data Retrieval exception detected for dialect, " + dialect, e);