意外的XML标签。预期:{http://schemas.xmlsoap.org/soap/envelope/}正文,但发现:{http://schemas.xmlsoap.org/soap/envelope/}信封

时间:2019-05-16 14:40:51

标签: java android xml soap retrofit2

正在使用SOAP XML,我已经在线验证了xml很好,但是当发送到服务器时收到错误消息“意外的XML标记。预期:{http://schemas.xmlsoap.org/soap/envelope/}正文,但发现:{http://schemas.xmlsoap.org/soap/envelope/ }信封”,这是xml正在发送

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:pos="http://pos/">
<soapenv:Header>
    <soapenv:Body>
        <pos:balanceInquiry>
            <iccData></iccData>
            <pinBlock></pinBlock>
            <terminalId></terminalId>
        </pos:balanceInquiry>
    </soapenv:Body>
</soapenv:Header>

我删除了标记中的值,一切都保持不变。

@Root(name = "soapenv:Envelope")
@NamespaceList({
        @Namespace( prefix = "soapenv", reference = "http://schemas.xmlsoap.org/soap/envelope/"),
        @Namespace( prefix = "pos", reference = "http://pos/")
})

public class XMLRequestEnvelope {

    @Element(name = "soapenv:Header", required = false)
    private XMLRequestHeader header;

    public XMLRequestHeader getHeader() {
        return header;
    }

    public void setHeader(XMLRequestHeader header) {
        this.header = header;
    }
}

@Root(name =“ soapenv:Header”,strict = false) 公共类XMLRequestHeader {

@Element(name = "soapenv:Body", required = false)
private XMLRequestBody body;

public XMLRequestBody getBody() {
    return body;
}

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

}

    @Root(name = "soapenv:Body", strict = false)



     public class XMLRequestBody {
    @Element(name = "pos:balanceInquiry",required = false)



private XMLBalanceInquiry xmlBalanceInquiry;



 public XMLBalanceInquiry getXmlBalanceInquiry() {
        return xmlBalanceInquiry;
    }



  public void setXmlBalanceInquiry(XMLBalanceInquiry xmlBalanceInquiry) {

        this.xmlBalanceInquiry = xmlBalanceInquiry;
    }
    }






 @Root(name = "pos:balanceInquiry", strict = false)
public class XMLBalanceInquiry {



@Element(name = "iccData", required = false)
    private String emvData;

    @Element(name = "pinBlock", required = false)
    private String pinBlock;



 @Element(name = "phoneNo", required = false)
    private String phoneNo;

    @Element(name = "terminalId", required = false)
    private String terminalId;



  public String getEmvData() {
        return emvData;
    }



 public void setEmvData(String emvData) {
        this.emvData = emvData;
    }



 public String getPinBlock() {
        return pinBlock;
    }



public void setPinBlock(String pinBlock) {
        this.pinBlock = pinBlock;
    }




  public String getPhoneNo() {
        return phoneNo;
    }




 public void setPhoneNo(String phoneNo) {
        this.phoneNo = phoneNo;
    }



 public String getTerminalId() {
        return terminalId;
    }



   public void setTerminalId(String terminalId) {
        this.terminalId = terminalId;
    }
}

0 个答案:

没有答案