* @param xml
* @return
* @throws Exception
*/
private SoapMethodCall parseSoapBody(String xml) throws Exception {
SoapMethodCall smc = null;
String lines[] = xml.split("\n");
boolean inBody = false;
int i = 0;
int iArgCounter = 0;
while(i < lines.length){
String line = lines[i].trim();
if(line.toLowerCase().indexOf("body ") > -1){
i++;
line = lines[i].trim();
smc = new SoapMethodCall(this.getSoapMethodName(line));
inBody = true;
continue;
}
if(line.toLowerCase().indexOf("body>") > -1){
inBody = false;
}
if(inBody){
if(line.toLowerCase().indexOf("arg" + iArgCounter + "_") > -1){
String argName = this.getSoapArgumentName(line);
String argXml = "";
// empty argument including ending slash in tag
if(argName.endsWith("/")){
argName = argName.substring(0, argName.length() - 1).trim();
smc.addParameterXml(argName, argXml);
i++;
continue;
}
// starting and ending tags both in same line
if(line.substring(line.indexOf(argName) + argName.length()).indexOf(argName) > -1){
argXml = this.getOneLineValue(line);
smc.addParameterXml(argName, argXml);
i++;
continue;
}
i++;
while(lines[i].indexOf(argName) == -1){
argXml += lines[i].trim();
i++;
}
smc.addParameterXml(argName, argXml);
iArgCounter++;
}
}
i++;