javax.wsdl.Operation operation = definition.createOperation();
operation.setName(op.getName());
operation.setUndefined(false);
Input input = definition.createInput();
Message inputMsg = definition.createMessage();
String namespaceURI = definition.getQName().getNamespaceURI();
QName inputMsgName = new QName(namespaceURI, op.getName());
inputMsg.setQName(inputMsgName);
inputMsg.setUndefined(false);
definition.addMessage(inputMsg);
// FIXME: By default, java interface is mapped to doc-lit-wrapper style WSDL
if (op.getWrapper() != null) {
// Generate doc-lit-wrapper style
inputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, true));
} else {
// Bare style
int i = 0;
for (DataType d : op.getInputType().getLogical()) {
inputMsg.addPart(generatePart(definition, d, "arg" + i));
i++;
}
}
input.setMessage(inputMsg);
operation.setInput(input);
if (!op.isNonBlocking()) {
Output output = definition.createOutput();
Message outputMsg = definition.createMessage();
QName outputMsgName = new QName(namespaceURI, op.getName() + "Response");
outputMsg.setQName(outputMsgName);
outputMsg.setUndefined(false);
definition.addMessage(outputMsg);
if (op.getWrapper() != null) {
outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, false));
} else {
outputMsg.addPart(generatePart(definition, op.getOutputType(), "return"));
}
output.setMessage(outputMsg);
operation.setOutput(output);
operation.setStyle(OperationType.REQUEST_RESPONSE);
} else {
operation.setStyle(OperationType.ONE_WAY);
}
for (DataType<DataType> faultType: op.getFaultTypes()) {
Fault fault = definition.createFault();
QName faultName = ((XMLType)faultType.getLogical().getLogical()).getElementName();
fault.setName(faultName.getLocalPart());
Message faultMsg = definition.getMessage(faultName);
if (faultMsg == null) {
faultMsg = definition.createMessage();
faultMsg.setQName(faultName);
faultMsg.setUndefined(false);
definition.addMessage(faultMsg);
faultMsg.addPart(generatePart(definition, faultType.getLogical(), faultName.getLocalPart()));
}
fault.setMessage(faultMsg);
operation.addFault(fault);
List<ElementInfo> elements = null;
if (faultType.getLogical().getPhysical() != faultType.getPhysical()) {