protected void buildPortTypeOperation(PortType portType,
Collection<OperationInfo> operationInfos,
final Definition def) {
for (OperationInfo operationInfo : operationInfos) {
Operation operation = null;
try {
operation = operationInfo.getProperty(
WSDLServiceBuilder.WSDL_OPERATION, Operation.class);
} catch (ClassCastException e) {
// do nothing
}
if (operation == null) {
operation = def.createOperation();
addDocumentation(operation, operationInfo.getDocumentation());
operation.setUndefined(false);
operation.setName(operationInfo.getName().getLocalPart());
addNamespace(operationInfo.getName().getNamespaceURI(), def);
if (operationInfo.isOneWay()) {
operation.setStyle(OperationType.ONE_WAY);
}
addExtensibilityElements(operation, getWSDL11Extensors(operationInfo));
Input input = def.createInput();
addDocumentation(input, operationInfo.getInput().getDocumentation());
input.setName(operationInfo.getInputName());
Message message = def.createMessage();
buildMessage(message, operationInfo.getInput(), def);
this.addExtensibilityAttributes(input, getInputExtensionAttributes(operationInfo));
this.addExtensibilityElements(input, getWSDL11Extensors(operationInfo.getInput()));
input.setMessage(message);
operation.setInput(input);
operation.setParameterOrdering(operationInfo.getParameterOrdering());
if (operationInfo.getOutput() != null) {
Output output = def.createOutput();
addDocumentation(output, operationInfo.getOutput().getDocumentation());
output.setName(operationInfo.getOutputName());
message = def.createMessage();
buildMessage(message, operationInfo.getOutput(), def);
this.addExtensibilityAttributes(output, getOutputExtensionAttributes(operationInfo));
this.addExtensibilityElements(output, getWSDL11Extensors(operationInfo.getOutput()));
output.setMessage(message);
operation.setOutput(output);
}
//loop to add fault
Collection<FaultInfo> faults = operationInfo.getFaults();
Fault fault = null;
for (FaultInfo faultInfo : faults) {
fault = def.createFault();
addDocumentation(fault, faultInfo.getDocumentation());
fault.setName(faultInfo.getFaultName().getLocalPart());
message = def.createMessage();
buildMessage(message, faultInfo, def);
this.addExtensibilityAttributes(fault, faultInfo.getExtensionAttributes());
this.addExtensibilityElements(fault, getWSDL11Extensors(faultInfo));
fault.setMessage(message);
operation.addFault(fault);
}
}
portType.addOperation(operation);
}
}