+49 228 5552576-0


Compare WSDL Java API

The following listing shows how to compare two WSDL documents with Java and the Membrane 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) {
  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<Difference> 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 + "  ");

Listing 1: CompareWSDL.java

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.