无法满足字段 'body' 上的 @org.simpleframework.xml.Element(data=false, name=soap:Body, required=true, type=void)

Unable to satisfy @org.simpleframework.xml.Element(data=false, name=soap:Body, required=true, type=void) on field 'body'

我正在尝试反序列化这个小 xml 但没有成功。我得到了例外;

无法在字段 'body'

上满足 @org.simpleframework.xml.Element(data=false, name=soap:Body, required=true, type=void)
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <Response xmlns="http://asdasdasd.com/">
            <Result>true</Result>
            <AppPath />
            <Message />
        </Response>
    </soap:Body>
</soap:Envelope>

谁能解决这个问题? 哦! classes:

信封class:

@Root(name = "soap:Envelope", strict = false)
@NamespaceList({
        @Namespace(prefix = "xsd", reference = "http://www.w3.org/2001/XMLSchema"),
        @Namespace(prefix = "xsi", reference = "http://www.w3.org/2001/XMLSchema-instance"),
        @Namespace(prefix = "soap", reference = "http://schemas.xmlsoap.org/soap/envelope/")
})
public class ResponseEnvelope {

    @Element(name = "soap:Body")
    private CheckVersionResponseBody body;

    public CheckVersionResponseBody getBody() {
        return body;
    }

    public void setBody(CheckVersionResponseBody body) {
        this.body = body;
    }

    public ResponseEnvelope() {
    }

    public ResponseEnvelope(CheckVersionResponseBody body) {
        this.body = body;
    }
}

正文class

@Root(name = "soap:Body")
public class CheckVersionResponseBody {

    @Element(name = "Response")
    @Namespace(reference = "http://asdasdasd.com/")
    Response response;

    public CheckVersionResponseBody() {
    }

    public CheckVersionResponseBody(Response response) {
        this.response = response;
    }

    public Response getVersionControlGeneralResponse() {
        return versionControlGeneralResponse;
    }
}

好吧,如果 "FUTURE" 中的其他人有这个问题,我找到了答案。

只是去掉正文中的前缀。那。

@Root(name = "Body")
public class CheckVersionResponseBody {

    @Element(name = "Response")
    @Namespace(reference = "http://asdasdasd.com/")
    Response response;

    public CheckVersionResponseBody() {
    }

    public CheckVersionResponseBody(Response response) {
        this.response = response;
    }

    public Response getVersionControlGeneralResponse() {
        return versionControlGeneralResponse;
    }
}