// Get the definition element
Definition definition = wsdlDocument.getDefinitions();
// Get service reference from analyzer context
ServiceReference serviceReference = analyzerContext.getServiceReference();
// Create normalized data about the service under test.
CandidateInfo candidate = new CandidateInfo(serviceReference, wsdlDocument);
analyzerContext.setCandidateInfo(candidate);
// Set prereq type to entry container
reporter.setPrereqType(Reporter.PREREQ_TYPE_ENTRY_CONTAINER);
// always process Import, Definitions & Types assertions
// TEMP:
if (processDefAssertions)
{
processDefinitionAssertions(classPrefix, candidate);
processTypesAssertions(classPrefix, candidate);
processImportAssertions(classPrefix, candidate);
}
// Process the element hierarchy in the WSDL document starting with the one that was specified
// FIX: Element finding already completed by CandidateInfo constructor - so use that rather than retest here
// ---------------------------
// wsdl:port
// ---------------------------
if (serviceReference.getWSDLElement().isPort())
{
// Find the service element
if ((service =
definition.getService(
serviceReference.getWSDLElement().getParentElementQName()))
== null)
{
throw new WSIRuntimeException(
"Could not locate WSDL service: "
+ serviceReference.getWSDLElement().getParentElementName());
}
// Find the port element
if ((port = service.getPort(serviceReference.getWSDLElement().getName()))
== null)
{
throw new WSIRuntimeException(
"Could not locate WSDL port: "
+ serviceReference.getWSDLElement().getName());
}
// TEMP: Remove until there are port test assertions
//processPortAssertions(port, serviceReference, classPrefix, wsdlDocument);
// Next, process the binding
if (((binding = port.getBinding()) == null) || (binding.isUndefined()))
{
//throw new WSIRuntimeException("Could not locate WSDL binding for port: " + port.getName());
// Set missingInput for all binding, portType, operation and message test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_BINDING));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_PORTTYPE));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_OPERATION));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_MESSAGE));
}
else
{
processBindingAssertions(
binding,
serviceReference,
classPrefix,
wsdlDocument);
// Next, process the portType
if (((portType = binding.getPortType()) == null)
|| (portType.isUndefined()))
{
//throw new WSIRuntimeException("Could not locate WSDL portType for binding: " + binding.getQName().getLocalPart());
// Set missingInput for all portType, operation and message test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_PORTTYPE));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_OPERATION));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_MESSAGE));
}
else
{
processMessageAssertions(
binding,
serviceReference,
classPrefix,
wsdlDocument);
processPortTypeAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
processOperationAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
processMessageAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
}
}
}
// ---------------------------
// wsdl:binding
// ---------------------------
else if (serviceReference.getWSDLElement().isBinding())
{
WSDLElement wsdlElement = serviceReference.getWSDLElement();
// Find the binding element
if (wsdlElement.getQName() != null
&& wsdlElement.getQName().getLocalPart() != null
&& wsdlElement.getQName().getLocalPart().length() > 0)
{
if (((binding =
definition.getBinding(serviceReference.getWSDLElement().getQName()))
== null)
|| (binding.isUndefined()))
{
throw new WSIRuntimeException(
"Could not locate WSDL binding: "
+ serviceReference.getWSDLElement().getName());
}
processBindingAssertions(
binding,
serviceReference,
classPrefix,
wsdlDocument);
processMessageAssertions(
binding,
serviceReference,
classPrefix,
wsdlDocument);
// Next, process the portType
if (((portType = binding.getPortType()) == null)
|| (portType.isUndefined()))
{
//throw new WSIRuntimeException("Could not locate WSDL PortType for Binding: " + binding.getQName().getLocalPart());
// Set missingInput for all portType, operation and message test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_PORTTYPE));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_OPERATION));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_MESSAGE));
}
else
{
processPortTypeAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
processOperationAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
// Process each message within each operation of the portType associated with the binding
processMessageAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
}
}
// There was a problem with the binding element specification. This can
// happen when a UDDI tModel did not have a valid binding reference.
else
{
// Set missingInput for all binding, portType, operation and message test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_BINDING));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_PORTTYPE));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_OPERATION));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_MESSAGE));
}
}
// ---------------------------
// wsdl:portType
// ---------------------------
else if (serviceReference.getWSDLElement().isPortType())
{
// Find the PortType element
if (((portType =
definition.getPortType(serviceReference.getWSDLElement().getQName()))
== null)
|| (portType.isUndefined()))
{
throw new WSIRuntimeException(
"Could not locate WSDL PortType: "
+ serviceReference.getWSDLElement().getName());
}
// Set missingInput for all binding test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_BINDING));
processPortTypeAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
processOperationAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
// Process each message within each operation of the portType
processMessageAssertions(
portType,
serviceReference,
classPrefix,
wsdlDocument);
}
// ---------------------------
// wsdl:operation
// ---------------------------
else if (serviceReference.getWSDLElement().isOperation())
{
// Find the operation
// get portType from config parent element
if (((portType =
definition.getPortType(
serviceReference.getWSDLElement().getParentElementQName()))
== null)
|| (portType.isUndefined()))
{
throw new WSIRuntimeException(
"Could not locate WSDL portType: "
+ serviceReference.getWSDLElement().getParentElementQName());
}
if (((operation =
getOperationFromPortType(
portType,
serviceReference.getWSDLElement().getName()))
== null)
|| (operation.isUndefined()))
{
throw new WSIRuntimeException(
"Could not locate WSDL Operation: "
+ serviceReference.getWSDLElement().getName()
+ "in portType: "
+ portType.getQName());
}
// Set missingInput for all binding and portType test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_BINDING));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_PORTTYPE));
processOperationAssertions(
operation,
portType,
serviceReference,
classPrefix,
wsdlDocument);
processMessageAssertions(
operation,
serviceReference,
classPrefix,
wsdlDocument);
}
// ---------------------------
// wsdl:message
// ---------------------------
else if (serviceReference.getWSDLElement().isMessage())
{
// Find the message
if (((message =
definition.getMessage(serviceReference.getWSDLElement().getQName()))
== null)
|| (message.isUndefined()))
{
throw new WSIRuntimeException(
"Could not locate WSDL Message: "
+ serviceReference.getWSDLElement().getName());
}
// Set missingInput for all binding, portType, and operation test assertions
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_BINDING));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_PORTTYPE));
setMissingInput(EntryType.getEntryType(TYPE_DESCRIPTION_OPERATION));
processMessageAssertions(
message,
serviceReference,
classPrefix,
wsdlDocument);
}
else
{
throw new WSIRuntimeException(
"The following WSDL type is not supported: "
+ serviceReference.getWSDLElement().getType());
}
// Cleanup
cleanup();
}