3

I have some classes generated from WSDL files by the Axis Framework. In one of these classes, there is a generated method


public com.initechsystems.www.initech7.initechbo.Organization createOrganization(com.initechsystems.www.initech7.initechbo.Organization org) throws java.rmi.RemoteException {

//(... snip ...)
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
//(... snip ...)
}

The variable name org in the method parameter creates a naming clash with package org.apache.axis.client, as the compiler cannot differentiate between the package and variable. I realize I can fix this easily by changing the variable name org in the method, but I would like to avoid this, because it slows down the workflow. Is there some way around this other than either modifying the WSDL file or the generated classes?

Compiler error:


 D:\projects\java\initechdir\target\generated-sources\axistools\wsdl2java\com\initechsystems\www\initech7\initechws\OrganizationManagement\OrganizationManagementSoapStub.java:[1678,29] cannot find symbol
symbol  : variable apache
location: class com.initechsystems.www.initech7.initechbo.Organization
Cactus
  • 27,075
  • 9
  • 69
  • 149
simon
  • 12,666
  • 26
  • 78
  • 113
  • Please post the text of the compiler error. – Kees de Kooter Mar 17 '09 at 13:57
  • Edited in original post. – simon Mar 17 '09 at 14:05
  • That's funny (as in "ha ha", not as in "weird"). I guess I've never tried to name a variable java or javax or org before. – Michael Myers Mar 17 '09 at 14:13
  • yea, I thought the same thing. – Herms Mar 17 '09 at 14:17
  • This humor is supplied by some "Initech" developers, who developed the .NET web service, probably without considering the consequences of such a variable name. But I agree, it is funny in some kind of way. – simon Mar 17 '09 at 14:43
  • The compiler mentions symbol apache. Can you post line 1678? – Kees de Kooter Mar 17 '09 at 14:47
  • Line 1678 is _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); as mentioned in the original post. The symbol "apache" confuses the compiler, because apparently it expects it to be a property of the org variable. – simon Mar 17 '09 at 15:15

1 Answers1

2

Is there a way to cause that generated code to have import statements? That would prevent you from having to have the fully-qualified name of the class.

So, if you could add:

import org.apache.axis.client.Call;

to the file then your method call would just be:

_call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE);

I'm not sure if Axis has an option for that though. If not I'd say renaming the variable (maybe to "organization") would be the best thing. I would recommend avoiding manual edits of auto-generated files, as that makes regenerating them harder.

Herms
  • 37,540
  • 12
  • 78
  • 101
  • That's a good idea, but I think it's not possible - at least I haven't found a way to do it.. – simon Mar 24 '09 at 10:07