Search code examples
javaweb-serviceswsimport

Accessing Oracle sales cloud webservice from java


I am trying to use Oracle Sales Cloud web services. Web services have been consumed using wsimport and resultant jars have been added to the application.

wsimport command used for import: wsimport.exe -keep -clientjar PartnerService.jar https://cbdy-test.crm.us2.oraclecloud.com/partnerCenterCorePublicModel/PartnerService?WSDL

The jar builds with warnings. Same process was done for a total of 8 Oracle webservices.

Howeever when attempting to access the web services via the wsimport generated jar error's are thrown for 2 web servies out of 8.

Java snippet:

    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:

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)

I referred about this issue here and few other stackoverflow posts but i am unable to resolve this problem for the problematic web services.

Any pointers that would help in resolution would be helpful.


Solution

  • I was able to go past the issue in the question. The block of code calling web service call was working in a new project and in a different class within the same project. The problem seems to originate from the way the project is built.

    I built a new project step by step with the old code and the error didn't occur.