}
}
private Binding findBinding(Description discription) throws AxisFault {
Service[] services = discription.getServices();
Service service = null;
Endpoint endpoint = null;
Binding binding = null;
if (services.length == 0) {
throw new AxisFault("No service found in the WSDL");
}
if (serviceName != null) {
for (int i = 0; i < services.length; i++) {
if (serviceName.equals(services[i].getName())) {
service = services[i];
break; // found it. Stop looking.
}
}
if (service == null) {
throw new AxisFault("Service not found the WSDL "
+ serviceName.getLocalPart());
}
} else {
// If no particular service is mentioned select the first one.
service = services[0];
}
// FIXME @author Chathura get the policy stuff to be copied
// copyExtensibleElements(service.getExtensibilityElements(), dif,
// axisService, SERVICE);
Endpoint[] endpoints = service.getEndpoints();
if (this.interfaceName != null) {
if (endpoints.length == 0) {
throw new AxisFault("No Endpoints/Ports found in the service:"
+ service.getName().getLocalPart());
}
for (int i = 0; i < endpoints.length; ++i) {
if (this.interfaceName.equals(endpoints[i].getName().toString())) {
endpoint = endpoints[i];
break; // found it. Stop looking
}
}
if (endpoint == null) {
throw new AxisFault("No port found for the given name :"
+ this.interfaceName);
}
} else {
// if no particular endpoint is specified use the first one.
endpoint = endpoints[0];
}
axisService.setName(service.getName().getLocalPart());
if (endpoint != null) {
// FIXME @author Chathura copy in the policy stuff
// copyExtensibleElements(port.getExtensibilityElements(), dif,
// axisService, PORT);
axisService.setEndpoint(endpoint.getAddress().toString());