Hello,

I am writing the extension on quarkus for cxf. I have read a lot of the
code on github cxf and fixed a lot of issues but I still failed with native
compilation.
I am not sure if it comes from jaxp or jaxb or cxf reflection. Anyway, an
exception is thrown from cxf.

I have an exception:

*java.lang.RuntimeException: Invalid schema document passed to
AbstractDataBinding.addSchemaDocument, not in W3C schema namespace: schema
at *
org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:111)
at
org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:68)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:408)
at
org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:469)
at
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:693)

Analyze show that in AbstractDataBinding.addSchemaDocument the Document
contain:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><schema xmlns:tns="
http://cxf.it.quarkus.io/"; xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://cxf.it.quarkus.io/"; version="1.0">
<element name="reply" type="tns:reply"/>
<element name="replyResponse" type="tns:replyResponse"/>
<complexType name="reply"><sequence><element minOccurs="0" name="text"
type="xs:string"/></sequence></complexType>
<complexType name="replyResponse"><sequence><element minOccurs="0"
name="return" type="xs:string"/></sequence></complexType>
</schema>

Document.getDocumentElement() return a node Schema
but .getNamespaceURI() return null.

DOMSource domSource = new DOMSource(d);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = null;
try {
    transformer = tf.newTransformer();
    transformer.transform(domSource, result);
} catch (Exception e) {
}

Logger LOG = 
LogUtils.getL7dLogger(org.apache.cxf.endpoint.dynamic.TypeClassInitializer.class);
LOG.info("DOCUMENT :"+ writer.toString());
LOG.info("DOCUMENT element :"+ d.getDocumentElement().toString());
LOG.info("DOCUMENT namespace :"+ d.getDocumentElement().getNamespaceURI());

return:
DOCUMENT : [previous schema xml]
DOCUMENT element :[schema: null]
DOCUMENT namespace :null

So, my question is:
- is my schema badly valid ?
- What is class which parse Document to produce the namespaceUri ?

I was thinking the issue may come from package-info generation but it seems
oki.
Here is class decompilation from intelij:

package io.quarkus.it.cxf.jaxws_asm;

@javax.xml.bind.annotation.XmlSchema(namespace =
"http://cxf.it.quarkus.io/";, elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
interface $$package-info /* Real name is 'package-info' */ {
}


Here you have limitation of Graal in native:
https://www.graalvm.org/reference-manual/native-image/Limitations/

First, here is my work:
https://github.com/dufoli/quarkus-cxf

2 classes are very important:
https://github.com/dufoli/quarkus-cxf/blob/master/deployment/src/main/java/io/quarkus/cxf/deployment/QuarkusCxfProcessor.java
this one lists native documents and classname which need to been reflected.

https://github.com/dufoli/quarkus-cxf/blob/master/runtime/src/main/java/io/quarkus/cxf/graal/CXFSubstitutions.java
This one does substitution to remove class generation in CXF.

Cheers,
Olivier

Reply via email to