In the wsdl I have 2 types, same name, different cases: LoginResponse and LOGINRESPONSE.
If I use xfire to generate the java classes开发者_高级运维, it only generates one class, LoginResponse, discarding the LOGINRESPONSE.
How do I get around this?
<s:element name="LoginResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="LoginResult" type="tns:LOGINRESPONSE" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="LOGINRESPONSE">
<s:attribute name="Message" type="s:string" />
<s:attribute name="Token" type="s:string" />
<s:attribute name="DataFormat" type="s:string" />
<s:attribute name="Header" type="s:boolean" use="required" />
<s:attribute name="Suffix" type="s:boolean" use="required" />
</s:complexType>
Names declared in WSDL are indeed case sensitive, and it is legal to use names that differ only in their case. However, it has to be a bad idea:
Surely, it is a bad idea from the perspective of readability. (I mean, if you were writing a Java program you wouldn't declare variables
acat
andaCat
in the same namespace. Would you?)While WSDL is case sensitive, programming language bindings will need to map WSDL names to case insensitive program identifiers (e.g. in Visual Basic I believe), or they may case mangle them so that the generated identifiers conform to the programming language's style conventions. In either case, WSDL names that differ only in letter case can lead to problems.
IMO the best long term fix for your problem is to change the WSDL so that you don't have elements, types, etc whose names differ only by case.
精彩评论