微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

XmlElement 在 SOAP 中显示为小写

如何解决XmlElement 在 SOAP 中显示为小写

我有以下方法

public PingResponse ping(String xml) throws remoteexception {
    PingResponse response = new PingResponse();
    response.setPingResult("Service is Live");
    return response;
}

这是 PingResponse.java

@XmlRootElement(name = "PingResponse")
public class PingResponse implements java.io.Serializable {

    private String pingResult;

    @XmlElement(name = "PingResult")
    public String getPingResult() {
        return pingResult;
    }

    public void setPingResult(String pingResult) {
        this.pingResult = pingResult;
    }

我遇到的问题是我得到的 XML 响应的 pingResult 为小写。完整示例:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <PingResponse>
         <pingResult>Service is Live</pingResult>
      </PingResponse>
   </soapenv:Body>
</soapenv:Envelope>

知道这里可能有什么问题吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。