WSDLInterfaceOperationInput input = new WSDLInterfaceOperationInput(interfaceOperation);
WSDLBindingOperationInput bindingInput = new WSDLBindingOperationInput(bindingOperation);
QName operationName = operation.getQName();
input.setElement(operationName);
WSDLInterfaceOperationOutput output = null;
WSDLBindingOperationOutput bindingOutput = null;
boolean twoWay = !operation.isOneWay();
if (twoWay)
{
output = new WSDLInterfaceOperationOutput(interfaceOperation);
bindingOutput = new WSDLBindingOperationOutput(bindingOperation);
output.setElement(new QName(operationName.getNamespaceURI(), operationName.getLocalPart() + "Response"));
ParameterMetaData returnParameter = operation.getReturnParameter();
if (returnParameter != null)
{
QName xmlName = returnParameter.getXmlName();
String partName = returnParameter.getPartName();
if (returnParameter.isInHeader())
{
WSDLSOAPHeader header = new WSDLSOAPHeader(xmlName, partName);
header.setIncludeInSignature(true);
bindingOutput.addSoapHeader(header);
}
else
{
QName xmlType = returnParameter.getXmlType();
String ns = getNamespace(returnParameter.getJavaType(), xmlType.getNamespaceURI());
QName newXmlType = new QName(ns, xmlType.getLocalPart());
WSDLRPCPart part = new WSDLRPCPart(partName, newXmlType);
output.addChildPart(part);
}
addSignatureItem(interfaceOperation, returnParameter, true);
}
interfaceOperation.addOutput(output);
bindingOperation.addOutput(bindingOutput);
}
for (ParameterMetaData param : operation.getParameters())
{
if (param.isInHeader())
{
WSDLSOAPHeader header = new WSDLSOAPHeader(param.getXmlName(), param.getPartName());
header.setIncludeInSignature(true);
if (param.getMode() != ParameterMode.OUT)
bindingInput.addSoapHeader(header);
if (twoWay && param.getMode() != ParameterMode.IN)
bindingOutput.addSoapHeader(header);
}
else
{
QName xmlType = param.getXmlType();
String ns = getNamespace(param.getJavaType(), xmlType.getNamespaceURI());
QName newXmlType = new QName(ns, xmlType.getLocalPart());
WSDLRPCPart part = new WSDLRPCPart(param.getPartName(), newXmlType);
if (param.getMode() != ParameterMode.OUT)
input.addChildPart(part);
if (twoWay && param.getMode() != ParameterMode.IN)
output.addChildPart(part);
}
addSignatureItem(interfaceOperation, param, false);
}
interfaceOperation.addInput(input);