try {
ClassLoader classLoader = axisService.getClassLoader();
String serviceClassName = (String) axisService.getParameter("ServiceClass").getValue();
// create PortType with class name
PortType portType = new PortTypeImpl();
portType.setQName(axisService.getName());
definition.addPortType(portType);
portType.setUndefined(false);
Class serviceImplementation = classLoader.loadClass(serviceClassName);
Method[] methods = serviceImplementation.getMethods();
// add messages to the definition and operations to the port type
Operation wsdlOperation;
Input wsdlOperationInput;
Output wsdlOperationOutput;
Iterator operationDescIter = axisService.getOperations().values().iterator();
while (operationDescIter.hasNext()) {
AxisOperation axisOperation = (AxisOperation) operationDescIter.next();
QName methodName = axisOperation.getName();
Method method = getMethod(methods, methodName.getLocalPart());
// create axisOperation
wsdlOperation = new OperationImpl();
wsdlOperation.setName(methodName.getLocalPart());
wsdlOperation.setUndefined(false);
// create Output message and add that to the definition
Class returnType = method.getReturnType();
Message message = getMessage(mappings, returnType);
definition.addMessage(message);
// add the same message as the output of the axisOperation
wsdlOperationOutput = new OutputImpl();
wsdlOperationOutput.setMessage(message);
wsdlOperation.setOutput(wsdlOperationOutput);
Class[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < parameterTypes.length; i++) {
Class aClass = parameterTypes[i];
message = getMessage(mappings, aClass);
wsdlOperationInput = new InputImpl();
wsdlOperationInput.setMessage(message);
definition.addMessage(message);
wsdlOperation.setInput(wsdlOperationInput);
}
portType.addOperation(wsdlOperation);
}
} catch (ClassNotFoundException e) {
log.error("Can not load the service " + axisService + " from the given class loader");