Java 请求中带有jaxb null对象的Spring WS
Java 请求中带有jaxb null对象的Spring WS,java,spring,jaxb,Java,Spring,Jaxb,我有一个Spring WS,我正在向它发送对象request.java类的请求,如果我在jaxb类中硬编码值,它是可以的(但这不是它..) 我在SoapUI中测试的soap请求: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cas="http://jakisadres.com/caservice"> <soapenv:Header/> <
我有一个Spring WS,我正在向它发送对象
request.java
类的请求,如果我在jaxb类中硬编码值,它是可以的(但这不是它..)
我在SoapUI中测试的soap请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cas="http://jakisadres.com/caservice">
<soapenv:Header/>
<soapenv:Body>
<cas:Request>
<cas:atr1>some value</cas:machineName>
</cas:Request>
</soapenv:Body>
</soapenv:Envelope>
还有我的jaxb marshaller类:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"atr1"
})
@XmlRootElement(name = "Request")
public class Request{
protected String atr1;
public String getAtr1() {
return atr1;
}
public void setAtr1(String value) {
this.atr1 = value;
}
}
有什么线索我遗漏了什么吗?可能您的
atr1
元素在默认名称空间中,而不是http://jakisadres.com/caservice
namespace..您的请求应该是:
<cas:Request>
<atr1>some value</atr1>
</cas:Request>
一些价值
或者,您可以显式地为atr1
字段指定名称空间
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"atr1"
})
@XmlRootElement(name = "Request")
public class Request{
protected String atr1;
public String getAtr1() {
return atr1;
}
public void setAtr1(String value) {
this.atr1 = value;
}
}
<cas:Request>
<atr1>some value</atr1>
</cas:Request>