在Axis2中创建自定义例外
我正在使用Axis2 1.5.2和Eclipse。 我正在使用Eclipse从生成的WSDL生成WSDL和客户端代码。
我创建了一个我的服务可以抛出的自定义exception。 创建Web服务时,一切看起来都不错。 webservice成功启动,我可以通过指向我的Web浏览器来查看生成的WSDL。 但是当我告诉Eclipse使用生成的WSDL生成客户端代码时,我从Eclipse中收到此错误:
Error in generating Java from WSDL: java.io.IOException: ERROR: Missing element inFault "InsertUserException" in operation "InsertUserException", in binding insertUser java.io.IOException: ERROR: Missing element inFault "InsertUserException" in operation "InsertUserException", in binding insertUser at org.apache.axis.wsdl.symbolTable.SymbolTable.faultsFromSOAPFault(SymbolTable.java:2858)
我的自定义exception是“InsertUserException”:
public class InsertUserException extends Exception{ private String errorCode; public InsertUserException(String errorCode){.....} public String getErrorCode(){...} public void setErrorCode(String errorCode){...} }
客户端可以调用的服务操作是“insertUser”:
public void insertUser() throws InsertUserException{ ..... }
任何帮助表示赞赏。
Axis2不知道如何通过线路发送exception,除非它们是AxisFaults。
这是一篇关于如何将AxisFault与自定义exception信息一起使用的文章的链接。