Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce
Reporter/Name(from Bugbase): Mike Collins / Mike Collins (Mike Collins)
Created: 10/10/2013
Components: Web Services
Versions: 10.0
Failure Type: Non Functioning
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / Some users will encounter
Locale/System: English / Linux Red Hat All
Vote Count: 0
Problem Description:
I received this from a CF Customer:
In Axis2, there's a class called "CodeGeneratorEngine". When running from the command line, this is the generator used to translate a WSDL into java stubs. However, when runing Axis2 from inside CF10, Adobe injects their own version of CodeGeneratorEngine into Axis (called CFCodeGeneratorEngine ). it appears that they're doing it for performance reasons. You see, earlier in the CreateObject() process, CF10 has already used Apache HttpClient and a sax parser to acquire the .wsdl and parse it into a DOM document. Rather than parsing it over again, it keeps trying to pass around this DOM document. The native CodeGeneratorEngine doesn't support this method of generating stubs. It expects you to pass in the URI, and it basically takes over (using the baseURI of the WSDL for relative access to schemas). So, since the native CodeGeneratorEngine from Axis2 doesn't really support this approach (well, it kind of supports it, but it's dysfunctional -- producing exactly what we saw, no baseURI for schema access), Adobe had to create their own to get better performance. In the process, it appears that they broke relative schema addressing.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3648723
Deployment Phase: Release Candidate
External Customer Info:
External Company:
External Customer Name: mcollins323
External Customer Email:
External Test Config: To fix the problem
Original code in CFCodeGeneratorEngine
public CFCodeGenerationEngine(CommandLineOptionParser parser, Document wsdlDocument)
throws CodeGenerationException
{
Map allOptions = parser.getAllOptions();
try
{
CommandLineOption option = (CommandLineOption)allOptions.get("uri");
String wsdlUri = option.getOptionValue();
became
Change #1
public CFCodeGenerationEngine(CommandLineOptionParser parser, Document wsdlDocument)
throws CodeGenerationException
{
Map allOptions = parser.getAllOptions();
try
{
CommandLineOption option = (CommandLineOption)allOptions.get("uri");
String wsdlUri = option.getOptionValue();
// This came from the original CodeGenerationEngine... no idea why it was removed from the CF version
if (wsdlUri.startsWith("http")) {
URL url = new URL(wsdlUri);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setInstanceFollowRedirects(false);
connection.getResponseCode();
String newLocation = connection.getHeaderField("Location");
if (newLocation != null) {
wsdlUri = newLocation;
}
}
this.configuration = new CodeGenConfiguration(allOptions);
this.configuration.putProperty("uri", wsdlUri);
Change #2
public Definition readInTheWSDLFile(Document wsdlDocument)
throws WSDLException
{
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
reader.setFeature("javax.wsdl.importDocuments", true);
return reader.readWSDL(null, wsdlDocument); // this was the code they did differently from the Axis2 CodeGenerationEngine (probably trying to improve performance)
}
became
public Definition readInTheWSDLFile(Document wsdlDocument)
throws WSDLException
{
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
reader.setFeature("javax.wsdl.importDocuments", true);
// taken from the original CodeGenerationEngine... no idea why it was removed... may not be necessary, not sure what it's for
ExtensionRegistry extReg = WSDLFactory.newInstance().newPopulatedExtensionRegistry();
extReg.registerExtensionAttributeType(Input.class, new QName("http://www.w3.org/2006/05/addressing/wsdl", "Action"), 0);
extReg.registerExtensionAttributeType(Output.class, new QName("http://www.w3.org/2006/05/addressing/wsdl", "Action"), 0);
reader.setExtensionRegistry(extReg);
return reader.readWSDL((String)this.configuration.getProperty("uri")); // go back to the way Axis2's CodeGenerationEngine works... this allows schemas to be retrieved based on baseURI...
}
Attachments:
Comments: