I'm having a problem referencing and using the classes generated by WSDL2Java (for reference this is a follow on question from here: Java out of memory errors on large WSDLs (play framework)). Depending on how I try to reference the files it generates I get different errors when I run it. (Note: I just get these errors during runtime)
So, I run my WSDL2Java (with XMLBeans option) and then use ants to build it. After I've generated and built my classes I get the 3 standard folders and build file:
- build
- resources
- src
- build.xml
This contains all the good stuff. Next, within my project in Eclipse I've created a folder called dynamics and added the above 3 folders to it. To use the classes (without compile errors) I can simply add dynamics/build/classes to my buildpath/classpath. Note: in eclipse it seems a bit clunky to figure out the right way to add something to the class path... The way I initially tried this was:
Project -> Properties -> Libraries -> Add Class Folder
Another way was using:
Run -> Run Configurations -> Classpath
Neither way seems to make a difference. But either way I seem to be able to use my WSDL code and everything looks fine. But when I try to run it I hit some problems. Solely doing the above referencing I get the following error when I hit a webservice on my webapp:
The file /app/controllers/Application.java could not be compiled. Error rasied is : com.microsoft.schemas.xrm._2011.contracts.Entity cannot be resolved
So, to get around this, another thing I've tried is adding all of the generated source to my projects source folder. Basically take ALL of the WSDL generated .java files in dynamics/src and paste it into my project/app (basically where all of my project source code lives). This way gets me a lot further. I hit a webservice of my project, it in turn attempts to call a dynamics webservice (using the dynamics WSDL stuff)... and it's fine right up until I try to use an object that references XMLBeans object, which is when I hit my next error, which is:
Cannot load SchemaTypeSystem. Unable to load class with name schemaorg_apache_xmlbeans.system.<*really long id*>.TypeSystemHolder
So basically, it will let me generate my OrganizationServiceStub, but as soon as I try to run a request (e.g. RetrieveMultiple) it hits me with the above error.
Any ideas? Help very much appreciated!
A few details:
- I'm trying to reference this using Eclipse
- Using the XMLBeans option when running WSDL2Java
- Axis2 version 1.5.4
- Built using Apache ant 1.8.3
- Using PlayFramework
- Generating from a MS Dynamics WSDL (very large definition!)
Update
I've noticed that if I add the WSDL generated .java files as a new source folder (rather than copy/pasting all the .java files into my main project source folder) it gives this error:
The file /app/controllers/Application.java could not be compiled. Error rasied is : com.microsoft.schemas.xrm._2011.contracts.Entity cannot be resolved
This is a different error than if I copy and paste the source files... which seems odd to me...