}
if (portType != null)
{
BindingInput bindingInput = bindingOperation.getBindingInput();
BindingOutput bindingOutput = bindingOperation.getBindingOutput();
//String inputName = (bindingInput != null ? bindingInput.getName() : null);
//String outputName = (bindingOutput != null ? bindingOutput.getName() : null);
// hack code to get at operations that are defined with the same name but different
// inputs and outputs
Operation op = null;
List operations = portType.getOperations();
// get a list of all operations with matching names
List matchingOperations = new Vector();
Iterator iOperations = operations.iterator();
while (iOperations.hasNext())
{
Operation oper = (Operation)iOperations.next();
if (oper.getName().equalsIgnoreCase(bindingOperation.getName()))
{
matchingOperations.add(oper);
}
}
if (matchingOperations != null)
{
// If there's only one matching operation this is what we're referring to.
// Only matching if binding operation input name and output name are
// both null or the same as the portType operation input and output names.
// the portType operation name
if (matchingOperations.size() == 1)
{
// only say the single operation is the one we're looking for if the names
// of the binding input and output are not specified
Operation tempOp = (Operation)matchingOperations.get(0);
boolean inputOK = false;
boolean outputOK = false;
Input tempInput = tempOp.getInput();
Output tempOutput = tempOp.getOutput();
// order is important in these conditions. condition 2 must fail for 3 to work
// check the input
if (tempInput == null && bindingInput == null)
{
inputOK = true;
}
else if (bindingInput == null || bindingInput.getName() == null)
{
inputOK = true;
}
else if (tempInput != null && bindingInput.getName().equals(tempInput.getName()))
{
inputOK = true;
}
// check the output
if (tempOutput == null && bindingOutput == null)
{
outputOK = true;
}
else if (bindingOutput == null || bindingOutput.getName() == null)
{
outputOK = true;
}
else if (tempOutput != null && bindingOutput.getName().equals(tempOutput.getName()))
{
outputOK = true;
}
if (inputOK && outputOK)
{
op = tempOp;
}
// op = (Operation) matchingOperations.get(0);
}
// otherwise find the operation with the same name, inputname, outputname signature
if (matchingOperations != null && op == null)
{
Iterator iMatchingOperations = matchingOperations.iterator();
while (iMatchingOperations.hasNext())
{
boolean inputNamesEqual = false;
boolean outputNamesEqual = false;
Operation oper = (Operation)iMatchingOperations.next();
// if (oper.getName().equalsIgnoreCase(bindingOperation.getName()))
// {
Input opInput = oper.getInput();
if (opInput != null && bindingInput != null)
{
String opInputName = opInput.getName();
String bindingInputName = bindingInput.getName();
if (opInputName != null && opInputName.equalsIgnoreCase(bindingInputName))
{
inputNamesEqual = true;
}
else if (opInputName == null && bindingInputName == null)
{
inputNamesEqual = true;
}
}
else if (opInput == null && bindingInput == null)
{
inputNamesEqual = true;
}
Output opOutput = oper.getOutput();
if (opOutput != null && bindingOutput != null)
{
String opOutputName = opOutput.getName();
String bindingOutputName = bindingOutput.getName();
if (opOutputName != null && opOutputName.equalsIgnoreCase(bindingOutputName))
{
outputNamesEqual = true;
}
else if (opOutputName == null && bindingOutputName == null)