Web Service Newbie Question:

wsimport generates two classes: MyException and MyException_Exception for my wsdl-File, but MyException does not extend Exception. How to change this?

有帮助吗?

解决方案

Ok, I got it. The wsimport tool generates

  • one class for the xml type and
  • one class for the Exception.

This results in a name collision. Therefor the _Exception prefix is added to the wanted class.

The solution is to give the xml type a different name.

This is done by annotating the server-side class:

@XmlType(name = "UnknownDomainExceptionType", namespace = "...")
public class MyException extends Exception {
   ...
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top