There is no surprise for those who work with web-services a lot that they get updated from time to time. And you always need to track changes of these updates.
In my par
http://membrane-soa.org has a Java API for comparing WSDL in their SOA Model.
package sample.wsdl;
import java.util.List;
import com.predic8.wsdl.*;
import com.predic8.wsdl.diff.WsdlDiffGenerator;
import com.predic8.soamodel.Difference;
public class CompareWSDL {
public static void main(String[] args) {
compare();
}
private static void compare(){
WSDLParser parser = new WSDLParser();
Definitions wsdl1 = parser.parse("resources/diff/1/article.wsdl");
Definitions wsdl2 = parser.parse("resources/diff/2/article.wsdl");
WsdlDiffGenerator diffGen = new WsdlDiffGenerator(wsdl1, wsdl2);
List lst = diffGen.compare();
for (Difference diff : lst) {
dumpDiff(diff, "");
}
}
private static void dumpDiff(Difference diff, String level) {
System.out.println(level + diff.getDescription());
for (Difference localDiff : diff.getDiffs()){
dumpDiff(localDiff, level + " ");
}
}
}
After executing you get the output shown in listing 2. It is a List of differences between the two WSDL documents.
Port ArticleServicePTPort removed.
Port ArticleServicePTPort2 added.
Operation create removed.
Operation create2 added.
Schema http://predic8.com/wsdl/material/ArticleService/1/ has changed:
Element createResponse has changed:
ComplexType has changed:
Sequence has changed:
Element NewElementForTest added.
For an example of the output from the tool, http://www.service-repository.com/ offers an online WSDL Comparator tool that returns a report of the differences between two WSDL. The report is not a simple XML diff.