}
// Add the port and binding operations.
ArrayList operations = serviceDesc.getOperations();
for (Iterator i = operations.iterator(); i.hasNext();) {
OperationDesc thisOper = (OperationDesc)i.next();
BindingOperation bindingOper = writeOperation(def,
binding,
thisOper);
Operation oper = bindingOper.getOperation();
OperationDesc messageOper = thisOper;
if (serviceDesc2 != null) {
// If a serviceDesc containing an impl class is provided,
// try and locate the corresponding operation
// (same name, same parm types and modes). If a
// corresponding operation is found, it is sent
// to the writeMessages method so that its parameter
// names will be used in the wsdl file.
OperationDesc[] operArray =
serviceDesc2.getOperationsByName(thisOper.getName());
boolean found = false;
if (operArray != null) {
for (int j=0;
j < operArray.length && !found;
j++) {
OperationDesc tryOper = operArray[j];
if (tryOper.getParameters().size() ==
thisOper.getParameters().size()) {
boolean parmsMatch = true;
for (int k=0;
k<thisOper.getParameters().size() && parmsMatch;
k++) {
if (tryOper.getParameter(k).getMode() !=
thisOper.getParameter(k).getMode() ||
(! tryOper.getParameter(k).getJavaType().
equals(thisOper.getParameter(k).getJavaType()))) {
parmsMatch = false;
}
}
if (parmsMatch) {