I've recently been building a REST Service wrapper for Oracle Sales Cloud and initially all was going well, however as soon as I added all of my Web Service proxies I started to get weird errors..
My project structure looks like this
What I found out was if I only had the InteractionsService & OpportunityService WebService Proxies then all worked ok, but as soon as I added the LocationsService Proxy, I would start to see strange JAXB errors.
Example of the error message
Exception in thread "main" javax.xml.ws.WebServiceException: Unable to create JAXBContext
Looking further down I see the error message is related to JAXB not being able to find an objectFactory for one of its types
| Caused by: java.security.PrivilegedActionException: |
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 6 counts of
There's no ObjectFactory with an @XmlElementDecl for the
this problem is related to the following location:
at protected javax.xml.bind.JAXBElement
com.oracle.xmlns.apps.crmcommon.activities.activitiesservice.ActivityAssignee.assigneeRsrcOrgId at com.oracle.xmlns.apps.crmcommon.activities.activitiesservice.ActivityAssignee
This is very strange... My first thoughts are that when I generated the WebService Proxy I entered the package name as "oracle.demo.pts.fusionproxy.servicename" and left the generated types as blank. This way all the generated types get put into the same package hierarchy and when deployed they get merged...
Sounds resaonable and appears to work but not in this case..
To resolve this I regenerate the proxy but this time setting :
Package name : To the name of my package eg. oracle.demo.pts.fusionproxy.interactions
Root Package for Generated Types : Package where the types will be generated to, e.g. oracle.demo.pts.fusionproxy.SalesParty.types
When I ran the application now, it all works , awesome eh????
Alas no, there is a serious side effect.
The problem now is that to help coding I've created a collection of helper classes , these helper classes take parameters which use some of the "generic" datatypes, like FindCriteria.
e.g. This wont work any more
public static FindCriteria createCustomFindCriteria(FindCriteria pFc,String pAttributes)
Here lies a gremlin of a problem.. I cant use this method anymore, this is because the FindCriteria datatype is now being defined two, or more times, in the generated code for my project. If you leave the Root Package for types blank it will get generated to com.oracle.xmlns, and if you populate it then it gets generated to your custom package.. The two datatypes look the same, sound the same (and if this were a duck would sound the same), but THEY ARE NOT THE SAME...
Speaking to development, they recommend you should not be entering anything in the Root Packages section, so the mystery thickens why does it work..
Well after spending sometime with some colleagues of mine in development we've identified the issue.. Alas different parts of Oracle Fusion Development have multiple schemas with the same namespace, when the WebService generator generates its classes its not seeing the other schemas properly and not generating the Object Factories correctly...
|xjc -wsdl https://fusionservername:443/appCmmnCompInteractions/InteractionService?wsdl |
xjc -wsdl https://fusionservername443/opptyMgmtOpportunities/OpportunityService?wsdl