Hi

Please see comments below:

On 16/04/12 09:13, Ismael Hasan Romero wrote:
Hello,

I am trying to compile the REST services from EPO using the "wadl2java" command 
line utility (they can be found at http://www.epo.org/searching/free/ops.html) .

I've downloaded this WADL document and going to experiment with it


After several fixes in the description files I finally got a cast error from 
DocumentImpl to Node. This is the first time I compile a rest web service, so I 
am a bit lost and I don't know where this error may come from, so any help will 
be appreciated.


The options I am using are the following:
./wadl2java -V -wadlns http://ops.epo.org -p eposervices -d eporest/ -compile 
-classdir /tmp/eporest file:///tmp/ops.apache.wadl


The full trace of the error is the following:

WADLToJava Error: java.lang.ClassCastException: 
com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to 
org.w3c.dom.Element

org.apache.cxf.tools.common.ToolException: java.lang.ClassCastException: 
com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to 
org.w3c.dom.Element
        at 
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:84)
        at 
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
        at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:65)
        at org.apache.cxf.tools.wadlto.WADLToJava.run(WADLToJava.java:57)
        at org.apache.cxf.tools.wadlto.WADLToJava.main(WADLToJava.java:99)
Caused by: java.lang.ClassCastException: 
com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to 
org.w3c.dom.Element
        at 
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.writeResourceMethod(SourceGenerator.java:651)
        at 
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.writeMethods(SourceGenerator.java:524)
        at 
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.writeResourceClass(SourceGenerator.java:428)
        at 
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateResourceClasses(SourceGenerator.java:255)
        at 
org.apache.cxf.jaxrs.ext.codegen.SourceGenerator.generateSource(SourceGenerator.java:222)
        at 
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.processWadl(JAXRSContainer.java:153)
        at 
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:67)
        at 
org.apache.cxf.tools.wadlto.jaxrs.JAXRSContainer.execute(JAXRSContainer.java:76)
        ... 4 more



I managed to get past this issue, the code generator needs a couple of fixes to be able to better handle documents/schemas available at remote locations, ex, the schema reference is "/2.6.2/schema/ops.xsd", same for the base resource, but that is a minor issue, I'm seeing a long list of types being generated:

INFO: Created classes: org.epo.register.Absno, org.epo.register.Accepted, org.epo.register.ActionDate, org.epo.register.Addition, org.epo.register.AdditionalInfo,

.....................

org.epo.exchange.UnlinkedIndexingCodeType, org.epo.exchange.UrlType, org.epo.exchange.UsRightsType, org.epo.exchange.VidType

and then

java.lang.IllegalStateException: WADL resources element is missing
at org.apache.cxf.tools.wadlto.jaxrs.SourceGenerator.generateResourceClasses(SourceGenerator.java:244)

though I set the wadlns to "http://wadl.dev.java.net/2009/02";.

Looking into it though it will take me few days to sort it out as I'm traveling during the next 2 days

Cheers, Sergey









--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to