I need to find differences in two WSDL files. I started by pretty-printing them like here , but I see there are same things (eg complexType
s) in the two files defined (for whatever stupid reason) in a different order. I want to canonicalize the files further, so I can later use things like standard diff
to find the differences.
No idea if there's a defined canonical form for WSDL, I know there's Canonical XML , but I need to go a bit further and sort all the things whose order doesn't matter.
You can download a Java program from http://www.jclark.com/xml/ which converts XML to Canonical XML. This should be applicable to WSDL files too.
I ran through the tree recursively and sorted all children of nodes matching schema|wsdl:binding|wsdl:portType|wsdl:types|wsdl:definitions
. I used this answer for pretty-printing the output. For whatever reason format.setLineWidth(65);
doesn't work, so I had to join the lines using replaceAll("\\\\s*\\n\\\\s*(?=[^\\\\s<])", " ")
. It seems to work fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.