Closed ghost closed 9 years ago
I have tried to debug code and found that there can be a small tweak done to the code and can solve our problem. It would be very great if you can fix the issue by retaining all project architectural standards.
How I achieved the problem of tampered XSDs ? -- I have copied XSDs from source folder to destination folder using a method in Apache's commons io package
FileUtils.copyFile(File src, File dest)
How I got list of XSDs associated with a WSDL ?
-- I got a Map
with key and values as file names of XSDs by adding a new method to Wsdl.class
See below code changes required --
SoapMessageBuilder
class
public static Map saveWsdl2(String fileBaseName, URL wsdlUrl, File targetFolder) throws WSDLException {
WSDLReader reader = new WSDLReaderImpl();
reader.setFeature("javax.wsdl.verbose", false);
Definition definition = reader.readWSDL(wsdlUrl.toString());
return saveDefinition(fileBaseName, definition, targetFolder);
}
Add the below method to SoapLegacyFacade
class
public static Map saveWsdl2(URL wsdlUrl, String rootFileName, File folder) {
try {
return SoapMessageBuilder.saveWsdl2(rootFileName, wsdlUrl, folder);
} catch (WSDLException e) {
throw new SoapBuilderException(e);
}
}
Add the below method to Wsdl
class
public static Map saveWsdl2(URL wsdlUrl, File rootWsdl) {
return SoapLegacyFacade.saveWsdl2(wsdlUrl, rootWsdl.getName(), rootWsdl.getParentFile());
}
In you main method call
Map xsds = Wsdl.saveWsdl2(new File("Source WSDL").toURI().toURL(),
new File("destination"));
The map contains all the list of XSDs file names, you can copy all the XSDs from source to destination folder using FileUtils.copyFile(File src, File dest);
I was copying a WSDL file from one location to another using the method Wsdl.saveWsdl(URL url, File file). You know that the api have capability of copying the related XSDs also. The linked XSDs are copied to new location with updated references to XSDs in WSDl. However some of the copied XSDs are tampered, so when I'm importing in SoapUI tool for testing, I'm getting the below error