我正在尝试使用Oracle Sales Cloud Web服务。Web 服务已使用 wsimport 使用,生成的 jar 已添加到应用程序中。
用于导入的 wsimport 命令:wsimport.exe -keep -clientjar PartnerService.jar https://cbdy-test.crm.us2.oraclecloud.com/partnerCenterCorePublicModel/PartnerService?WSDL
罐子构建带有警告。总共对 8 个 Oracle Web 服务执行了相同的过程。
Howeever 在尝试通过 wsimport 生成的 jar 访问 Web 服务时,会为 8 个 Web 服务中的 2 个抛出错误。
Java 代码片段:
14.PartnerService_Service partnerService_Service = new PartnerService_Service(new URL("https://cbdy-test.crm.us2.oraclecloud.com/partnerCenterCorePublicModel/PartnerService?WSDL"));
15.PartnerService partnerService = partnerService_Service.getPartnerServiceSoapHttpPort();
16.Map<String, Object> requestCredentails = ((BindingProvider) partnerService).getRequestContext();
17.requestCredentails.put(BindingProvider.USERNAME_PROPERTY, "#######");
18.requestCredentails.put(BindingProvider.PASSWORD_PROPERTY, "#######");
例外:
Exception in thread "main" com.sun.xml.internal.ws.spi.db.DatabindingException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 17 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {http://xmlns.oracle.com/apps/cdm/foundation/parties/contactPointService/}OrigSystemReference.
this problem is related to the following location:
at protected javax.xml.bind.JAXBElement com.oracle.xmlns.apps.cdm.foundation.parties.contactpointservice.Edi.origSystemReference
at com.oracle.xmlns.apps.cdm.foundation.parties.contactpointservice.Edi
at protected java.util.List com.oracle.xmlns.apps.cdm.foundation.parties.organizationservice.OrganizationParty.edi
at com.oracle.xmlns.apps.cdm.foundation.parties.organizationservice.OrganizationParty
at public javax.xml.bind.JAXBElement com.oracle.xmlns.apps.cdm.foundation.parties.organizationservice.ObjectFactory.createOrganizationPartySourceSystemReferenceValue(java.lang.String)
at com.oracle.xmlns.apps.cdm.foundation.parties.organizationservice.ObjectFactory
....
at javax.xml.ws.Service.getPort(Unknown Source)
at com.oracle.xmlns.apps.partnermgmt.partnercenter.PartnerService_Service.getPartnerServiceSoapHttpPort(PartnerService_Service.java:68)
at com.oscservice.Dummy.main(Dummy.java:15)
我在这里提到了这个问题和其他一些堆栈溢出帖子,但我无法为有问题的 Web 服务解决这个问题。
任何有助于解决问题的指针都会有所帮助。
我能够通过问题中的问题。调用 Web 服务调用的代码块在新项目和同一项目的不同类中工作。问题似乎源于项目的构建方式。
我用旧代码逐步构建了一个新项目,但没有发生错误。