I used to generate sources from WSDL/bindings, using jaxws-maven-plugin with spring-boot 2.3.7 and java 11. Now, after upgrading to spring-boot 3.0 and java 17, code generation fails, because my bindings files are ignored with error message
bindings.xml: not a XML-WS- or XML-B-binding file
I've seen this error being discussed on StackOverflow, but none with spring-boot 3.0. Here is an example to reproduce error:
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>4.0.1</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<xdebug>true</xdebug>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
<configuration>
<packageName>com.daimler.daivb.cat.pkimgmt.bl.internal</packageName>
<verbose>true</verbose>
<xdebug>true</xdebug>
</configuration>
</plugin>
WSDL-File:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="HelloWorldService"
targetNamespace="http://example.com/helloworld"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://example.com/helloworld"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<types>
<xsd:schema targetNamespace="http://example.com/helloworld">
<xsd:element name="sayHello">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="sayHelloResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="greeting" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="sayHelloRequest">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="HelloWorldPortType">
<operation name="sayHello">
<input message="tns:sayHelloRequest"/>
<output message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="HelloWorldBinding" type="tns:HelloWorldPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HelloWorldService">
<port name="HelloWorldPort" binding="tns:HelloWorldBinding">
<soap:address location="http://localhost:8080/HelloWorld"/>
</port>
</service>
</definitions>
Binding file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxb:bindings xmlns:jaxb="http://jakarta.ee/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://jakarta.ee/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc"
jaxb:version="3.0">
<jaxb:bindings schemaLocation="https://jakarta.ee/xml/ns/jaxb/bindingschema_3_0.xsd">
<!-- Map xsd:date to java.time.LocalDate -->
<jaxb:javaType name="java.time.LocalDate"
xmlType="xs:date"
parseMethod="java.time.LocalDate.parse"
printMethod="java.time.LocalDate.toString"/>
<!-- Map xsd:time to java.time.LocalTime -->
<jaxb:javaType name="java.time.LocalTime"
xmlType="xs:time"
parseMethod="java.time.LocalTime.parse"
printMethod="java.time.LocalTime.toString"/>
<!-- Map xsd:dateTime to java.time.LocalDateTime -->
<jaxb:javaType name="java.time.LocalDateTime"
xmlType="xs:dateTime"
parseMethod="java.time.LocalDateTime.parse"
printMethod="java.time.LocalDateTime.toString"/>
</jaxb:bindings>
</jaxb:bindings>
Any ideas, why this happens? Please give only working answers. I've already tried any hint I could find. I've also tried different plugins (org.codehouse.mojo, com.sun.xml.ws, org.apache.xcf). None of them worked.
This is what I am using with Spring Boot 3.0 and Java 17:
It differs slightly from your version in the jaxb definition. I am then referencing the binding file (bindings.xml in my case) in the plugin configuration:
More information about the currently valid schema can be found on the Jakarta EE homepage.