从 java 访问 Oracle 销售云 Web 服务

Accessing Oracle sales cloud webservice from java

我正在尝试使用 Oracle Sales Cloud Web 服务。已使用 wsimport 使用 Web 服务并将生成的 jar 添加到应用程序。

用于导入的wsimport命令: wsimport.exe -keep -clientjar PartnerService.jar https://cbdy-test.crm.us2.oraclecloud.com/partnerCenterCorePublicModel/PartnerService?WSDL

生成带有警告的 jar。对总共 8 个 Oracle Web 服务完成了相同的过程。

但是,当尝试通过 wsimport 访问 Web 服务时,8 个 Web 服务中有 2 个会抛出 jar 错误。

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)

我提到了这个问题 here 和其他一些 Whosebug 帖子,但我无法为有问题的 Web 服务解决这个问题。

任何有助于解决问题的指示都会有所帮助。

我能够绕过问题中的问题。 调用 Web 服务调用的代码块在一个新项目和同一项目中的不同 class 中工作。 问题似乎源于项目的构建方式。

我用老代码一步步建了一个新项目,没有报错