我正在尝试使用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生成的jar错误访问Web服务,都会抛出8个Web服务。
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和其他一些stackoverflow帖子,但我无法解决有问题的Web服务的这个问题。
任何有助于解决的指针都会有所帮助。
答案 0 :(得分:0)
我能够在问题中解决问题。 调用Web服务调用的代码块在新项目中工作,并在同一项目中的不同类中工作。 问题似乎源于项目的构建方式。
我使用旧代码逐步构建了一个新项目,并且没有发生错误。