The error message that occurred in wsimport
used to automatically generate Soap client code for Java is in Japanese, and I could not find it if it was Japanese information, so I made a detour a little, so remarks.
[ERROR]Same name"xxxxxx.SampleResponse"class of/The interface is already in use.
Use class customization to resolve this conflict.
[ERROR] A class/interface with the same name "xxx" is already in use.
Use a class customization to resolve this conflict.
There are two possible causes.
--Duplicate name due to arbitrary specification of package name by specifying -p
option
--Duplicate name attribute value in wsdl ... May occur if the server side is .NET (extension asmx)
In the former case, it can be solved by executing wsimport
without specifying the -p
option (that is, according to wsdl
).
In my case it was the latter. Specifically, it seems bad that there is a definition with the same name () like the following SampleResponse
.
If you delete one of the definitions, the duplicate error disappears, but it ends up being an error because it is referenced by the method.
hoge.wsdl
<s:element name="SampleResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Response" nillable="true" type="tns:SampleResponse" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="SampleResponse">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Result" type="tns:SampleResponseResult" />
<s:element minOccurs="0" maxOccurs="1" name="ApplicationResponse" type="tns:SampleResponseApplicationResponse" />
</s:sequence>
</s:complexType>
As a countermeasure in this case, specify the following options in the wsimport
command. Note that there is no space after -B.
-B-XautoNameResolution
In this case, the classes SampleResponse
and SampleResponse2
are generated, so modify them as appropriate.
Recommended Posts