public List populateAllServices() throws AxisFault {
try {
if (log.isDebugEnabled()) {
log.debug("Entry: populateAllServices");
}
setup(); // setup contains code with gathers non-service specific info
// from the WSDL. This only needs to be done once per WSDL.
if (wsdl4jDefinition == null) {
if (log.isDebugEnabled()) {
log.debug("Exit: populateAllServices. wsdl definition is null!");
}
return null; // can't go any further without the wsdl
}
if (wsdl4jDefinition.getServices().size() > 0) {
Iterator wsdlServIter = wsdl4jDefinition.getServices().values().iterator();
if (wsdl4jDefinition.getServices().size() > 1){
// let the wsdlToservice builder to decide the port to generate binding
portName = null;
}
while (wsdlServIter.hasNext()) {
Service service = (Service) wsdlServIter.next();
// set the serviceName on the parent to setup call to populateService
serviceName = service.getQName();
this.axisService = new AxisService();
// now that serviceName and portName are set, call up to the
// parent class to populate this service.
AxisService retAxisService = populateService();
if (retAxisService != null) {
axisServices.add(retAxisService);
}
// reset the port name if it had set when moving to next service
portName = null;
}
} else {
throw new AxisFault("No service was not found in the WSDL at " +
wsdl4jDefinition.getDocumentBaseURI()
+ " with targetnamespace "
+ wsdl4jDefinition.getTargetNamespace());
}
if (log.isDebugEnabled()) {
log.debug("Exit: populateAllServices.");
}
return axisServices;
} catch (AxisFault e) {
throw e; // just rethrow any AxisFaults
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("populateAllServices caught Exception. Converting to AxisFault. " +
e.toString());
}
throw AxisFault.makeFault(e);
}
}
Public method to access the wsdl 1.1 file and create a List of AxisService objects.
For each port on each service in the wsdl, an AxisService object is created and
added to the List. The name of the AxisService is changed from the service name
to the port name, since port names are unique to the wsdl. |