public boolean checkR2201() {
for (PortType portType : wsdlHelper.getPortTypes(def)) {
Iterator ite = portType.getOperations().iterator();
while (ite.hasNext()) {
Operation operation = (Operation)ite.next();
if (isOverloading(operation.getName())) {
continue;
}
BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
Binding binding = wsdlHelper.getBinding(bop, def);
String bindingStyle = binding != null ? wsdlHelper.getBindingStyle(binding) : "";
String style = "".equals(wsdlHelper.getSOAPOperationStyle(bop))
? bindingStyle : wsdlHelper.getSOAPOperationStyle(bop);
if ("DOCUMENT".equalsIgnoreCase(style)) {
List<Part> partsList = wsdlHelper.getInMessageParts(operation);
int inmessagePartsCount = partsList.size();
SOAPBody soapBody = wsdlHelper.getBindingInputSOAPBody(bop);
if (soapBody != null) {
List parts = soapBody.getParts();
int boundPartSize = parts == null ? inmessagePartsCount : parts.size();
SOAPHeader soapHeader = wsdlHelper.getBindingInputSOAPHeader(bop);
boundPartSize = soapHeader != null
&& soapHeader.getMessage().equals(
operation.getInput().getMessage()
.getQName())
? boundPartSize - 1 : boundPartSize;
if (parts != null) {
Iterator partsIte = parts.iterator();
while (partsIte.hasNext()) {
String partName = (String)partsIte.next();
boolean isDefined = false;
for (Part part : partsList) {
if (partName.equalsIgnoreCase(part.getName())) {
isDefined = true;
break;
}
}
if (!isDefined) {
addErrorMessage("opartion: " + operation.getName() + " soapBody parts : "
+ partName + " not found in the message, wrong WSDL");
return false;
}
}
}
if (boundPartSize > 1) {
addErrorMessage("operation:" + operation.getName()
+ " more than one part bound to body");
return false;
}
}
int outmessagePartsCount = wsdlHelper.getOutMessageParts(operation).size();
soapBody = wsdlHelper.getBindingOutputSOAPBody(bop);
if (soapBody != null) {
List parts = soapBody.getParts();
int boundPartSize = parts == null ? outmessagePartsCount : parts.size();
SOAPHeader soapHeader = wsdlHelper.getBindingOutputSOAPHeader(bop);
boundPartSize = soapHeader != null
&& soapHeader.getMessage().equals(
operation.getOutput().getMessage()
.getQName())
? boundPartSize - 1 : boundPartSize;
if (parts != null) {
Iterator partsIte = parts.iterator();
while (partsIte.hasNext()) {
String partName = (String)partsIte.next();
boolean isDefined = false;
for (Part part : wsdlHelper.getOutMessageParts(operation)) {
if (partName.equalsIgnoreCase(part.getName())) {
isDefined = true;
break;
}
}
if (!isDefined) {
addErrorMessage("opartion: " + operation.getName() + " soapBody parts : "
+ partName + " not found in the message, wrong WSDL");
return false;
}
}
}
if (boundPartSize > 1) {
addErrorMessage("operation:" + operation.getName()
+ " more than one part bound to body");
return false;
}
}
}