Using JAXB binding extensions in wsimport
Asked Answered
C

0

2

I know how to enable extensions in a plain JAXB bindings file - list them in the root element's extensionBindingPrefixes:

<jaxb:bindings 
    version="1.0"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:extensionBindingPrefixes="xjc"
    ...>

However, a JAX-WS bindings file doesn't have anywhere to put this attribute.

<jaxws:bindings
    version="2.0"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    wsdlLocation="../wsdl/schema.wsdl"
    ...>

It cannot go in the root, nor in any of the nested jaxb:bindings elements.

How are you supposed to enable binding extensions?


Example command-line arguments used by jaxws-maven-plugin:2.4.1:

-keep
-s 'target/generated-sources/wsimport'
-d 'target/classes'
-encoding UTF-8
-extension
-Xnocompile
-B-XJsr303Annotations
-B-Xvalue-constructor
-B-Xinheritance
-b 'src/jaxws/bindings.xml'
'src/wsdl/schema.wsdl'
Cyte answered 22/9, 2016 at 13:28 Comment(10)
what versions of software are you using?Rickets
@KalpeshSoni jaxws-maven-plugin:2.3Cyte
you can specify multiple bindings file to wsimport using -b option. So having extensionBindingPrefixes in separate jaxb bindings file wouldn't help ?Mcglone
@Mcglone No, that didn't seem to do anything. I assume it only applies to the child elements.Cyte
what error do you get? or it simply doesnt add your interface?Rickets
@KalpeshSoni indeed, no errors. I know the xpaths etc are correct because things like jaxb:class name work fine. The extensions seem to be parsed (they fail if incorrect) but they don't do anything.Cyte
share the pom section?Rickets
@KalpeshSoni what are you hoping to see there?Cyte
What is the equivalent entry in maven for -XadditionalHeaders in cmd ?Schuh
@AbdulRazakAK read the documentationCyte

© 2022 - 2024 — McMap. All rights reserved.