return wsdlPortType;
}
private OperationImpl addOperation(Definition def, DOMImplementation dImpl, String methodName, String methodDesc,
String typens, OutputParameterType[] outputParameterTypes) {
OperationImpl operation = (OperationImpl) def.createOperation();
operation.setUndefined(false);
operation.setName(methodName);
if (outputParameterTypes.length == 0) {
operation.setStyle(OperationType.ONE_WAY);
} else {
operation.setStyle(OperationType.REQUEST_RESPONSE);
}
Document doc = dImpl.createDocument(WSDL_NAMEPSPACE, WSDL_DOCUMENTATION, null);
Element documentation = doc.createElement(WSDL_DOCUMENTATION);
documentation.appendChild(doc.createTextNode(methodDesc));
operation.setDocumentationElement(documentation);
MessageImpl inputMessage = (MessageImpl) def.createMessage();
String inputMessageName = methodName + GFacSchemaConstants.SERVICE_REQ_MSG_SUFFIX + "_" + UUID.randomUUID();
inputMessage.setQName(new QName(def.getTargetNamespace(), inputMessageName));
inputMessage.setUndefined(false);
PartImpl inPart = (PartImpl) def.createPart();
inPart.setName(PART_NAME);
String inputElementName = methodName + GFacSchemaConstants.SERVICE_IN_PARAMS_SUFFIX;
inPart.setElementName(new QName(typens, inputElementName));
inputMessage.addPart(inPart);
def.addMessage(inputMessage);
InputImpl ip = (InputImpl) def.createInput();
ip.setName(inputMessageName);
ip.setMessage(inputMessage);
operation.setInput(ip);
if (outputParameterTypes.length > 0) {
MessageImpl outputMessage = (MessageImpl) def.createMessage();
String outputMessageName = methodName + GFacSchemaConstants.SERVICE_RESP_MSG_SUFFIX + "_"
+ UUID.randomUUID();
outputMessage.setQName(new QName(def.getTargetNamespace(), outputMessageName));
outputMessage.setUndefined(false);
PartImpl part = (PartImpl) def.createPart();
part.setName(PART_NAME);
String outputElementName = methodName + GFacSchemaConstants.SERVICE_OUT_PARAMS_SUFFIX;
part.setElementName(new QName(typens, outputElementName));
outputMessage.addPart(part);
def.addMessage(outputMessage);
OutputImpl op = (OutputImpl) def.createOutput();
op.setName(outputMessageName);
op.setMessage(outputMessage);
operation.setOutput(op);
}
return operation;
}