我有一个cxf生成的jax-ws Web客户端正在调用服务,但出现此错误:
com.sun.xml.internal.ws.spi.db.DatabindingException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {http://medimpact.com/schema/CommonTypes/v1}startDate.
this problem is related to the following location:
at protected java.util.List com.medimpact.schema.commontypes.v1.DateRangeCriteria.content
at com.medimpact.schema.commontypes.v1.DateRangeCriteria
at protected com.medimpact.schema.commontypes.v1.DateRangeCriteria com.medimpact.schema.plan.v2.GroupCmsPlanSearchCriteria.dateRange
at com.medimpact.schema.plan.v2.GroupCmsPlanSearchCriteria
at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.medimpact.schema.plan.v2.GroupCmsPlanSearchCriteria])
at @javax.xml.bind.annotation.XmlSeeAlso(value=[class com.medimpact.schema.plan.v2.ClientGroupIdent, class com.medimpact.schema.plan.v2.GroupIdentifier])
at protected com.medimpact.schema.plan.v2.GroupIdent com.medimpact.contract.membergroup.v1.MbrGroupCoverageAdd.group
at com.medimpact.contract.membergroup.v1.MbrGroupCoverageAdd
at protected com.medimpact.contract.membergroup.v1.MbrGroupCoverageAdd com.medimpact.contract.membergroup.v1.AddGroupCoverageRequest.mbrGroupCoverage
at com.medimpact.contract.membergroup.v1.AddGroupCoverageRequest
at public com.medimpact.contract.membergroup.v1.AddGroupCoverageRequest com.medimpact.contract.membergroup.v1.ObjectFactory.createAddGroupCoverageRequest()
at com.medimpact.contract.membergroup.v1.ObjectFactory
at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory.newContext(JAXBRIContextFactory.java:90)
at com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(BindingContextFactory.java:167)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:203)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:176)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:95)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:309)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:85)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:59)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:43)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:105)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:875)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:892)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:855)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:435)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:404)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:386)
at javax.xml.ws.Service.getPort(Service.java:119)
at com.medimpact.contract.membergroup.v1_2.MemberGroupV12.getMemberGroupHttpSoap11(MemberGroupV12.java:72)
at com.medimpact.pamgmt.epa.epaprocessor.websvc.membergroup.impl.MemberGroupWebServiceInvokerImpl.getMemberGroupPortType(MemberGroupWebServiceInvokerImpl.java:116)
这是我的网络服务电话:
private PtMemberGroup getMemberGroupPortType() throws MalformedURLException{
logger.debug("In getMemberGroupPortType method");
MemberGroupV12 memberGroupV12SoapService = null;
//create an instance of the service with WSDL URL and return MEMBER GROUP Port type
try {
logger.debug("Create service instance with WSDL URL to fetch MEMBER GROUP Port type");
memberGroupV12SoapService = new MemberGroupV12(new URL(memberGroupWsdl));
} catch (MalformedURLException e) {
logger.error("Error creating SOAP PORT",e);
}
return memberGroupV12SoapService.getMemberGroupHttpSoap11();
}
但是ObjectFactory具有@XmlElementDecl元素:
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*
*/
@XmlElementDecl(namespace = "http://medimpact.com/schema/CommonTypes/v1", name = "startDate", scope = DateRangeCriteria.class)
public JAXBElement<String> createDateRangeCriteriaStartDate(String value) {
return new JAXBElement<String>(_DateRangeCriteriaStartDate_QNAME, String.class, DateRangeCriteria.class, value);
}
所以一切似乎都井井有条,不确定是什么问题?我正在使用Java 8。