Tuesday, February 3, 2015

wsdl2java notes


* Simple type "MAXEXTGBRUPL_OutType" was not mapped to Enum due to EnumMemberSizeCap limit. Facets count: 502, current limit: 256. You can use customization attribute "typesafeEnumMaxMembers" to extend the limit.
<jaxb:globalBindings typesafeEnumMaxMembers="2000">

* Problems with underscores in names:
<jaxb:globalBindings underscoreBinding="asCharInWord" >

* A class/interface with the same name "hr.samara.RspHeaderType" is already in use. Use a class customization or the -autoNameResolution option to resolve this conflict.
add -autoNameResolution to wsdl2java.bat 
"%JAVA_HOME%\bin\java" -Xmx128M -Djava.endorsed.dirs="%CXF_HOME%\lib\endorsed" -cp "%CXF_JAR%;%TOOLS_JAR%;%CLASSPATH%" -Djava.util.logging.config.file="%CXF_HOME%\etc\logging.properties" org.apache.cxf.tools.wadlto.WADLToJava -autoNameResolution %*

Example of jaxb bindings file:

<jaxb:bindings
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:extensionBindingPrefixes="xjc"
    jaxb:version="2.0">
    <jaxb:globalBindings typesafeEnumMaxMembers="2000" >
<xjc:serializable/>
    </jaxb:globalBindings>
</jaxb:bindings>

Ant script code:

<property name="cxf.home" location="/apache-cxf-2.7.10/" />

<!-- generate classes from wsdl -->
<path id="cxf.classpath">
<fileset dir="${cxf.home}/lib">
<include name="*.jar"/>
</fileset>
</path>

<target name="cxfWSDLToJava-HSS9860WSDL.wsdl">
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-p"/>
<arg value="hr.samara.generated.HSS9860"/>
<arg value="-d"/>
<arg value="src/main/java"/>
<arg value="-verbose"/>
<arg value="-b" />
<arg value="src/main/resources/jaxbbindings.xml" />
<arg value="-autoNameResolution" />
<arg value="src/main/resources/HSS9860/HSS9860WSDL.wsdl"/>
<classpath>
<path refid="cxf.classpath"/>
</classpath>
</java>
</target>


Ref:
http://cwweng.tumblr.com/post/7000245700/wsdltojava-error-thrown-by-jaxb-two-declarations
https://cxf.apache.org/docs/wsdl-to-java.html

No comments:

Post a Comment