<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> </soap12:Body> </soap12:Envelope
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "body" }) @XmlRootElement(name = "soap12:Envelope") public class SoapEnvelope { @XmlElement(name = "soap12:Body") private SoapBody body; @XmlAttribute(name = "xmlns:xsi") private String xmlnsXsi; @XmlAttribute(name = "xmlns:xsd") private String xmlnsXsd; @XmlAttribute(name = "xmlns:soap12") private String xmlnsSoap; public SoapEnvelope() { this.xmlnsXsi = "http://www.w3.org/2001/XMLSchema-instance"; this.xmlnsXsd = "http://www.w3.org/2001/XMLSchema"; this.xmlnsSoap = "http://www.w3.org/2003/05/soap-envelope"; } public SoapBody getBody() { return body; } public void setBody(SoapBody body) { this.body = body; } }
XmlRootElement表示的意思是根节点,通过name = "soap12:Envelope"指定根节点的名称。
@XmlElement(name = "soap12:Body") private SoapBody body
这里意思soap12:Envelope下面还有1个节点叫soap12:Body
@XmlAttribute(name = "xmlns:xsi") private String xmlnsXsi