}
protected void processOperation(WSDLInterface wsdlInterface, WSDLBinding wsdlBinding, OperationMetaData operation)
{
WSDLInterfaceOperation interfaceOperation = new WSDLInterfaceOperation(wsdlInterface, operation.getQName());
WSDLBindingOperation bindingOperation = new WSDLBindingOperation(wsdlBinding);
interfaceOperation.setPattern(operation.isOneWay() ? Constants.WSDL20_PATTERN_IN_ONLY
: Constants.WSDL20_PATTERN_IN_OUT);
bindingOperation.setRef(operation.getQName());
bindingOperation.setSOAPAction(operation.getSOAPAction());
if (operation.getStyle() == Style.DOCUMENT)
processOperationDOC(interfaceOperation, bindingOperation, operation);
else
processOperationRPC(interfaceOperation, bindingOperation, operation);
for (FaultMetaData fault : operation.getFaults())
{
QName faultName = new QName(operation.getQName().getNamespaceURI(), fault.getXmlName().getLocalPart());
WSDLInterfaceFault interfaceFault = new WSDLInterfaceFault(wsdlInterface, faultName);
interfaceFault.setElement(fault.getXmlName());
wsdlInterface.addFault(interfaceFault);
WSDLInterfaceOperationOutfault outfault = new WSDLInterfaceOperationOutfault(interfaceOperation);
String ns = getNamespace(fault.getJavaType(), fault.getXmlName().getNamespaceURI());
QName outFaultName = new QName(ns, fault.getXmlName().getLocalPart());
outfault.setRef(outFaultName);
interfaceOperation.addOutfault(outfault);
WSDLBindingFault bindingFault = new WSDLBindingFault(wsdlBinding);
bindingFault.setRef(faultName);
wsdlBinding.addFault(bindingFault);
}
// process optional documentation
if (operation.getDocumentation() != null)
{
String prefix = wsdl.getPrefix(Constants.URI_JAXWS_WSDL_CUSTOMIZATIONS);
if (prefix == null)
{
prefix = "jaxws";
wsdl.registerNamespaceURI(Constants.URI_JAXWS_WSDL_CUSTOMIZATIONS, prefix);
}
Element javadocElement = DOMUtils.createElement(Constants.WSDL_ELEMENT_JAXWS_JAVADOC.getLocalPart(), prefix);
javadocElement.setTextContent(operation.getDocumentation());
Element methodElement = DOMUtils.createElement(Constants.WSDL_ELEMENT_JAXWS_METHOD.getLocalPart(), prefix);
methodElement.setAttribute("name", operation.getQName().getLocalPart());
methodElement.appendChild(javadocElement);
Element bindingsElement = DOMUtils.createElement(Constants.WSDL_ELEMENT_JAXWS_BINDINGS.getLocalPart(), prefix);
bindingsElement.appendChild(methodElement);
WSDLExtensibilityElement ext = new WSDLExtensibilityElement(Constants.URI_JAXWS_WSDL_CUSTOMIZATIONS, bindingsElement);
interfaceOperation.addExtensibilityElement(ext);
interfaceOperation.setDocumentationElement(new WSDLDocumentation(operation.getDocumentation()));
}
wsdlInterface.addOperation(interfaceOperation);
wsdlBinding.addOperation(bindingOperation);
}