Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML/WSDL Comparison tool

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 particular case I deal with web service defined by WSDL and I get classes generated based on this WSDL.

But before regeneration of classes from updated WSDL I would like to see what was changed in WSDL and determine amount of changes - to see what should I be prepared for.

Unfortunately, if I compare just .wsdl files of new and old version it doesn't always work very well for one reason - wsdl contents can be reordered (refactored internally). That's the reason to find more semantic tool.

I've tried Oxygen XML Diff tool but it doesn't also work well for me.

I am looking for a tool which will take two XMLs and bring me only semantic differences, e.g.:

  • Element A added
  • Added subelement b7 to element B

For this to work I guess the tool must load and deeply analyze the structure, Oxygen XML Diff was claim to do it well, but it just an improved version of text files comparison.

Could you recommend a working to for that, in particular to see updates in web-services based on WSDL.

UPDATE 1: New Idea is to compare generated sources rather than WSDLs.

Thank you.

like image 916
Vladimir Avatar asked Nov 09 '11 11:11

Vladimir


People also ask

How can I compare two WSDL files?

To run a sample wsdl diff just go to soa-model-distribution-1.4. x\samples\diff and double click on wsdl-diff-sample. bat . This will compare two different versions of article.

How check WSDL is correct or not?

How to test: Start soapUI, click on File -> New WSDL Project, specify the Project name and your initial WSDL that you would like to test, click OK. It will appear in the left side frame, expand your project, so, you can see your WSDL, then right click on the WSDL and click on "Check WS-I compliance".

Is WSDL based on XML?

WSDL, or Web Service Description Language, is an XML based definition language. It's used for describing the functionality of a SOAP based web service.


1 Answers

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<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 + "  ");
    }
  }
}

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.

like image 200
Mads Hansen Avatar answered Sep 23 '22 12:09

Mads Hansen