}
}
if (port == null)
{
throw new WSIException(
"WSDL Port \'"
+ portName
+ "\' for Service \'"
+ serviceName
+ "\' not found in service description");
}
else
{
this.ports = new Port[] { port };
// ADD: do serviceLocation check for soapbind:address?
descendents(port);
}
// ADD: the following could be instantiated here instead to refine context info
// definitions
// imports
// types
}
else if (wsdlElement.isBinding())
{
if (wsdlElement.getQName() != null
&& wsdlElement.getQName().getLocalPart() != null
&& wsdlElement.getQName().getLocalPart().length() > 0)
{
Binding binding =
wsdlDocument.getDefinitions().getBinding(wsdlElement.getQName());
if (binding == null)
{
throw new WSIException(
"WSDL Binding named \'"
+ wsdlElement.getQName()
+ "\' not found in service description");
}
else
{
this.bindings = new Binding[] { binding };
// the rest ... below binding:
// portTypes from binding
// operations from portTypes
// messages from operations
descendents(binding);
// above binding:
// ports
// definitions, imports, types (future?)
// ancestors(bindings);
}
}
}
else if (wsdlElement.isPortType())
{
PortType portType =
wsdlDocument.getDefinitions().getPortType(wsdlElement.getQName());
this.portTypes = new PortType[] { portType };
if (portType == null)
{
throw new WSIException(
"WSDL PortType named \'"
+ wsdlElement.getQName()
+ "\' not found in service description");
}
else
{
this.portTypes = new PortType[] { portType };
// the rest ... below portType:
descendents(portType);
// above portType:
// ports
// definitions, imports, types (future) ?
//ancestors(portTypes);
}
}
else if (wsdlElement.isOperation())
{
Operation operation = null;
String configOpName = wsdlElement.getName();
// Use parentElementName to qualify the operation within a portType.
QName portTypeName = wsdlElement.getParentElementQName();
PortType[] p = wsdlDocument.getPortTypes();
for (int i = 0; i < p.length && operation == null; i++)
{
if (p[i].getQName().equals(portTypeName))
{
// wsdl4j available method call below implies that only
// name+inputname+outputname uniquely defines operation!
// Since we do not have <input> & <output> name information
// available in the config, use this instead for now: -
// Get the first operation we find:
Iterator opIt = p[i].getOperations().iterator();
Operation op = null;
while (opIt.hasNext() && operation == null)
{
op = (Operation) opIt.next();
if (configOpName.equals(op.getName()))
{
operation = op;
}
}
}
}
if (operation == null)
{
throw new WSIException(
"No WSDL Operation named \'"
+ wsdlElement.getQName()
+ "\' found in service description");
}
else
{
this.operations = new Operation[] { operation };
descendents(operation);
//ancestors(operations);
}
}
else if (wsdlElement.isMessage())
{
Message message =
wsdlDocument.getDefinitions().getMessage(wsdlElement.getQName());
if (message == null)
{
throw new WSIException(
"No WSDL Message named \'"
+ wsdlElement.getQName()
+ "\' found in service description");
}
else
{
this.messages = new Message[] { message };
//ancestors(messages);
}
}
else
{
throw new WSIException(
"Unrecognised <WSDLElement type> in config: " + wsdlElement.getType());
}
// get info about the effective service location (s)
//this.endPoints = deriveEndpoints(analyzerConfig, this.ports, this.definitions);