WsdlPortType portType = iterator.next();
Iterator<WsdlPortTypeOperation> operations = portType
.operations().iterator();
while (operations.hasNext()) {
WsdlPortTypeOperation operation = operations.next();
WsdlMessagePart leadHeaderPart = new WsdlMessagePart(
LEAD_HEADER);
leadHeaderPart.setName(LEAD_HEADER);
// we hand set this element to xml because when you use the
// API it doent add the namespace correctly
leadHeaderPart.xml().setAttributeValue(ELEMENT,
LC_CONTEXT);
wsdl.getMessage(
operation.getInput().getMessage().getLocalPart())
.addPart(leadHeaderPart);
}
}
Iterator<WsdlBinding> bindingItr = wsdl.bindings().iterator();
while (bindingItr.hasNext()) {
WsdlBinding wsdlBinding = (WsdlBinding) bindingItr.next();
Iterator<WsdlBindingOperation> operationsItr = wsdlBinding
.operations().iterator();
while (operationsItr.hasNext()) {
WsdlBindingOperation wsdlBindingOperation = (WsdlBindingOperation) operationsItr
.next();
org.xmlpull.infoset.XmlElement input = wsdlBindingOperation
.xml().element(INPUT);
org.xmlpull.infoset.XmlElement body = input.element(BODY);
if(body == null){
//This is a HTTP binding so continue with the next
continue;
}
body.setAttributeValue(PARTS, INPUT);
XmlNamespace ns = body.getNamespace();
org.xmlpull.infoset.XmlElement header = input.newElement(
ns, HEADER);
header.setAttributeValue(PART, LEAD_HEADER);
header.setAttributeValue(USE, LITERAL);
String inputMessage = findInputMessage(
wsdlBindingOperation, wsdl);
header.setAttributeValue(MESSAGE, inputMessage);
body.removeAttribute(body.attribute(PARTS));
String inputPartName = null;
WsdlMessage wsdlMessage = wsdl
.getMessage(findInputMessaQname(
wsdlBindingOperation, wsdl).getLocalPart());
Iterable<WsdlMessagePart> parts = wsdlMessage.parts();
Iterator<WsdlMessagePart> partsItr = parts.iterator();
while (partsItr.hasNext()) {
WsdlMessagePart wsdlMessagePart = (WsdlMessagePart) partsItr
.next();
if (!LEAD_HEADER.equals(wsdlMessagePart.getName())) {
inputPartName = wsdlMessagePart.getName();
break;
}
}
if (null == inputPartName) {