0
Мне нужно поместить xmlns в каждый компонент SOAP, а также в модель данных, включенную в тело SOAP, но когда я просто включаю ns в имя XmlElement, это не работайте правильно, спасибо.Префикс XML-пространства имен d2lm on d2LogicalModel не определен с помощью jaxb
SOAP Body:
package soap;
import eu.datex2.schema._2_0._2_3.D2LogicalModel;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
@XmlType(name = "body", propOrder = {
"soapBody"
})
@XmlAccessorType(XmlAccessType.FIELD)
public class Body {
@XmlElement(name="d2lm:d2LogicalModel")
private D2LogicalModel soapBody;
public Body() {
this.soapBody = new D2LogicalModel();
}
public D2LogicalModel getSoapBody() {
return this.soapBody;
}
public void setSoapBody(D2LogicalModel soapBody) {
this.soapBody = soapBody;
}
}
SOAP заголовок:
пакет мыло;
import eu.datex2.schema._2_0._2_3.D2LogicalModel;
import javax.xml.bind.annotation.*;
@XmlType(name = "envelope", propOrder = {
"soapEnv",
"soapHeader",
"body"
})
@XmlRootElement(name = "soapenv:Envelope")
@XmlAccessorType(XmlAccessType.FIELD)
public class Envelope {
@XmlAttribute(name="xmlns:soapenv")
private String soapEnvEncodingStyle;
@XmlAttribute(name="xmlns:env")
private String soapEnv;
@XmlElement(name="soapenv:Header")
private String soapHeader;
@XmlAttribute(name="xmlns:xdt")
private String soapXdt;
@XmlAttribute(name="xmlns:xsd")
private String soapXsd;
@XmlAttribute(name="env:schemaLocation")
private String schemaLocation;
@XmlElement(name="soapenv:Body")
private Body body;
public Envelope(){
this.soapEnvEncodingStyle = "http://schemas/xmlsoap.org/soap/envelope/";
this.soapEnv = "http://www.w3.org/2001/XMLSchema-instance";
this.soapXdt = "http://www.w3.org/2004/07/xpath-datatypes";
this.soapXsd = "http://www.w3.org/2001/XMLSchema";
this.schemaLocation = "http://schemas/xmlsoap.org/soap/envelope/";
this.soapHeader = new String();
this.body = new Body();
}
public Body getSoapBody() {
return this.body;
}
public void setBody(Body soapBody) {
this.body = soapBody;
}
}