public void engage() {
// TODO XSLTConstants.BASE_64_PROPERTY_KEY
WSDLDescription womDescription = configuration.getWom();
String serviceName = configuration.getServiceName();
Document document = getEmptyDocument();
Element rootElement = document.createElement("stubMethods");
WSDLService wsdlService = null;
WSDLInterface wsdlInterface = null;
if (serviceName != null) {
wsdlService = womDescription.getService(new QName(serviceName));
} else {
for (Iterator iterator = womDescription.getServices().values()
.iterator(); iterator.hasNext();) {
wsdlService = (WSDLService) iterator.next();
serviceName = wsdlService.getName().getLocalPart();
configuration.setServiceName(serviceName);
break;
}
}
if (wsdlService != null) {
String port = configuration.getPortName();
WSDLEndpoint wsdlEndpoint = null;
if (port == null) {
for (Iterator iterator = wsdlService.getEndpoints().values()
.iterator(); iterator.hasNext();) {
wsdlEndpoint = (WSDLEndpoint) iterator.next();
port = wsdlEndpoint.getName().getLocalPart();
configuration.setPortName(port);
break;
}
} else {
wsdlEndpoint = wsdlService.getEndpoint(new QName(port));
}
if (wsdlEndpoint == null) {
System.err.println("no wsdl:port found for the service");
return;
}
WSDLBinding wsdlBinding = wsdlEndpoint.getBinding();
wsdlInterface = wsdlBinding.getBoundInterface();
for (Iterator iterator = wsdlInterface.getOperations().values()
.iterator(); iterator.hasNext();) {
WSDLOperation wsdlOperation = (WSDLOperation) iterator.next();
Policy policy = util.getPolicyForOperation(wsdlEndpoint.getName(),
wsdlOperation.getName());
if (policy != null) {
processPolicies(document, rootElement, policy,
wsdlEndpoint, wsdlOperation);
}
}
}
for (Iterator iterator = womDescription.getWsdlInterfaces().values()
.iterator(); iterator.hasNext();) {
wsdlInterface = (WSDLInterface) iterator.next();
break;
}