对于那些使用Web服务的人来说,不时会有更新,这并不奇怪.而且您总是需要跟踪这些更新的更改.
在我特定的情况下,我处理由WSDL定义的Web服务,并且我获取基于此WSDL生成的类.
但是在从更新的WSDL更新类之前,我想看看WSDL中发生了什么变化并确定更改量 – 看看我应该做些什么.
不幸的是,如果我只比较新版本和旧版本的.wsdl文件,因为一个原因,wsdl内容可以重新排序(内部重构),并不总是很好.这就是找到更多语义工具的原因.
我尝试过Oxygen XML Diff工具,但对我来说也不是很好.
我正在寻找一个工具,它将使用两个XML,并且仅带来语义差异,例如:
为了这个工作,我猜这个工具必须加载并深入分析结构,Oxygen XML Diff是声称做得很好,但它只是一个改进的文本文件比较版本.
你可以推荐一个工作,特别是在基于WSDL的Web服务中查看更新.
更新1:新想法是比较生成的源而不是WSDL.
谢谢.
http://membrane-soa.org在
SOA Model有
Java API for comparing WSDL.
原文链接:https://www.f2er.com/xml/292199.htmlpackage 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.
有关该工具输出的示例,http://www.service-repository.com/提供了一个online WSDL Comparator tool,它返回两个WSDL之间差异的报告.该报告不是一个简单的XML差异.