鉴于此wsdl
https://betaservices.flhsmv.gov/ResidencyCheckService/ResidencyCheckService.svc?wsdl
我使用wsimport导入。像这样设置对服务的调用:
FLRESWebServiceService service= new FLRESWebServiceService();
IFLRESWebService serv = service.getPort(IFLRESWebService.class);
serv.wsVerifyFlResidency("userid", "pass1234", "someid", "01-01-1990");
出现此错误:
引起:javax.xml.bind.MarshalException:Class" pkg_flres.WsVerifyFlResidency"是JAXBContext已知但无法编组,因为它缺少@XmlRootElement注释
我是否正确使用此服务?
编辑。这是班级,它显然在那里。
@XmlRootElement(name = "wsVerifyFlResidency")
public class WsVerifyFlResidency {
@XmlElementRef(name = "i_UserId", namespace = "http://pkg_FLRES", type = JAXBElement.class)
protected JAXBElement<String> iUserId;
@XmlElementRef(name = "i_Password", namespace = "http://pkg_FLRES", type = JAXBElement.class)
protected JAXBElement<String> iPassword;
@XmlElementRef(name = "i_DlNumber", namespace = "http://pkg_FLRES", type = JAXBElement.class)
protected JAXBElement<String> iDlNumber;
@XmlElementRef(name = "dob", namespace = "http://pkg_FLRES", type = JAXBElement.class)
protected JAXBElement<String> dob;
答案 0 :(得分:0)
是的,您正在正确调用该服务。虽然WsVerifyFlResidency中缺少注释,但错误很明显。 你可以检查下面的注释是否存在于WsVerifyFlResidency类中。
public static double normalizeAngleDegrees(double angle) {
return Math.toDegrees(Math.atan2(Math.sin(Math.toRadians(angle)), Math.cos(Math.toRadians(angle))));
}
如果没有尝试添加它。