0
我正在從java中生成wsdl。我在java字段中給出了nillable = false,但是該字段接受來自Web服務請求的空值。我的豆是Nillable = false在apache中不工作cxf
import java.util.Date;
import java.util.Formatter;
import java.util.Locale;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.springframework.format.annotation.DateTimeFormat;
@XmlRootElement(name = "LocationData")
@XmlAccessorType(XmlAccessType.FIELD)
public class LocationData {
private String id;
@DateTimeFormat(pattern="yyyy-mm-dd")
private Date date;
@NotNull
@XmlElement(required=true,nillable=false)
private String timezone;
@XmlElement(required=true,nillable=false)
private String location;
public void setTimezone(String timezone) {
this.timezone = timezone;
}
public String getTimezone() {
return timezone;
}
public void setLocation(String location) {
this.location = location;
}
public String getLocation() {
return location;
}
public void setDate(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Formatter formatter = new Formatter(sb, Locale.US);
formatter.format("ID:%s\nLocation:%s\nDate:%s\nTime zone:%s\n", getId(), getLocation(), getDate(), getTimezone());
return sb.toString();
}
}
我的界面
@WebMethod
public LocationData createLocation(LocationData locationData) throws DuplicateLocationException;
請讓我知道,可能是什麼問題?我錯過了什麼?任何幫助,將不勝感激。
同樣地,我會做50種元素50種不同的正則表達式檢查。在這種情況下,如果我使用上述方法,我將不得不創建50個限制庫。有什麼辦法可以爲每個元素聲明正則表達式模式 – user6543599