How to make it recognize bingings file and then generate java classes from wsdl?
pom
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<generatePackage>com.example.demo.schema.gbg</generatePackage>
<generateDirectory>${project.basedir}/src/main/java</generateDirectory>
<schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<include>*.wsdl</include>
</schemaIncludes>
<bindingDirectory>${project.basedir}/src/main/resources/bindings/</bindingDirectory>
<bindingIncludes>*.xml</bindingIncludes>
</configuration>
</plugin>
</plugins>
</build>
jaxb-bindings.xml
<?xml version="1.0" encoding="UTF-8" ?>
<jaxws:bindings
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Name the package consistently (don't use wsdl URI domain name) -->
<jaxws:package name="com.id3global"/>
<!-- Use 'wrapper style rules' to produce Java names - no I don't know what it means either -->
<jaxws:enableWrapperStyle>true</jaxws:enableWrapperStyle>
<!-- Disable generation of asynchronous send/receive methods - might be fun for later though :) -->
<jaxws:enableAsyncMapping>false</jaxws:enableAsyncMapping>
<!-- Do not generate Element properties - they collide with the type namespace in Java,
and yes, *all* this boilerplate is required for wsimport to apply the setting correctly -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" elementFormDefault="qualified"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
attributeFormDefault="unqualified" jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1">
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindings generateElementProperty="false">
<xjc:serializable/>
</jaxb:globalBindings>
</xs:appinfo>
</xs:annotation>
</xs:schema>
</jaxws:bindings>
Console:
org.xml.sax.SAXParseException; not an external binding file.
The root element must be {http://java.sun.com/xml/ns/jaxb}bindings but it is {http://java.sun.com/xml/ns/jaxws}bindings
Are you missing jaxb namespace declaration? Add jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb
as shown in example below.
Also can you move the JAXWS-element inside of JAXB-element. Something like.
<?xml version="1.0"?>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.1" jaxb:extensionBindingPrefixes="xjc annox">
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
</jaxws:bindings>
</jaxb:bindings>