0

I had created java classes from wsdl using maven plugin, below mention the related entry in pom.xml

<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>${maven-jaxb2-plugin.version}</version>
<executions>
    <execution>
        <goals>
            <goal>generate</goal>
        </goals>
    </execution>
</executions>
<configuration>
    <generatePackage>om.sd</generatePackage>
    <generateDirectory>${project.basedir}/src/main/java</generateDirectory>
    <schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
    <args>
        <arg>-no-header</arg>
    </args>
    <schemaIncludes>
        <include>*.wsdl</include>
    </schemaIncludes>
</configuration>
</plugin>

Java classes are generated.

The request class elements are created as JAXB element instead of String, which I need to convert manually to String.

Is there any way I can configure so that elements will be created as String instead of JAXB element.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user630209
  • 1,123
  • 4
  • 42
  • 93
  • https://stackoverflow.com/questions/12508741/jaxb-generating-jaxbelementstring-instead-of-string might help you. – Alien Nov 06 '18 at 05:28
  • @Alien I saw this and I had created the jaxb-bindings.xml. The given pom.xl where do I add this ? – user630209 Nov 06 '18 at 05:31
  • @user630209 By default, name your binding file `whatever.xjb` and put it into `src/main/resources`. – lexicore Nov 23 '18 at 21:04

1 Answers1

1

Take the given snippet from the linked question...

<jaxb:bindings ... xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc">
  <jaxb:globalBindings generateElementProperty="false">
    <xjc:simple />
    <!-- ... -->
  </jaxb:globalBindings>
</jaxb:bindings>

... and generate a custom *.xjb file containing the custom wrapper. Put the file within the schema directory - the plugin should find it by default.

If you want to put the file into a directory of your choice, just reference it within the configuration section of the plugin within the POM.

<bindingDirectory>src/main/resources</bindingDirectory>
<bindingIncludes>
  <include>**/*.xjb</include>
</bindingIncludes>
<bindingExcludes>
  <exclude>**/*.xj</exclude>
</bindingExcludes>

Need more information?

[1] https://github.com/highsource/maven-jaxb2-plugin/wiki/Specifying-What-To-Compile

[2] http://websystique.com/java/jaxb/jaxb-codegeneration-maven-example/

saschadoemer
  • 71
  • 1
  • 3