当从WSDL创建客户端时,如何在客户端?中设置myException.java的路径

时间:2014-02-03 13:28:06

标签: java wsdl jax-ws fault

我有服务器,服务器方法抛出我的异常 - MBFault:

import javax.xml.ws.WebFault;

@WebFault(name = "fault.MBFault", 
        targetNamespace = "fault")
public class MBFault extends Exception {

    private String detail;

    public MBFault(String message, String detail) {
        super(message);
        this.detail = detail;
    }

    public MBFault(String message, String detail, Throwable cause) {
        super(message, cause);
        this.detail = detail;
    }

    public String getDetail() {
        return detail;
    }
}

基于服务器我创建了一个WSDL,从我创建的WSDL客户端(wsimport -s myPackage ... wsdl)。 如何在客户端设置MBFault的路径?如果我想,那MBFault.java保存在包“fault”中,而所有其他包保存在客户端的“otherClasses”中。请帮帮我。

1 个答案:

答案 0 :(得分:0)

您可能需要进行以下更改:

@WebFault(
        name            = "MBFault", 
        targetNamespace = "http://fault"
)

Java API for XML Web Services Annotations中查看更多内容。