mojohaus / jaxws-maven-plugin

https://www.mojohaus.org/jaxws-maven-plugin/
Apache License 2.0
25 stars 37 forks source link

Unable to make working "xjcArg" "-Xinject-code" #68

Open rgambelli opened 6 years ago

rgambelli commented 6 years ago

I'm using jaxws-maven-plugin 2.5 with jdk1.8.0_121. I have a simple wsdl and an even more simple binding file where I'm trying, without success, to add a method in a generated from wsdl bean. It isn't working without any warnings or errors.

jaxws-maven-plugin is configured in this way:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.5</version>                
    <configuration>
        <!-- tell JAXB to actually use the XJC plugins -->
        <xjcArgs>
            <xjcArg>-extension</xjcArg>
            <xjcArg>-Xinject-code</xjcArg>
            <!--<xjcArg>-Xsync-methods</xjcArg>-->
        </xjcArgs>
    </configuration>
    <executions>
        <execution>
            <id>wsimport-generate-mail-service</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>wsimport</goal>
            </goals>
            <configuration>
                <sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
                <verbose>true</verbose>
                <packageName>it.cbt.mail.ws.client</packageName>
                <vmArgs>
                    <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                </vmArgs>
                <!--<wsdlLocation>http://localhost:9393/MailProxyServer/services/mail-service?wsdl</wsdlLocation>-->
                <wsdlLocation>${project.basedir}/src/wsdl/mail-service.wsdl</wsdlLocation>
                <staleFile>${project.build.directory}/jaxws/stale/mail-service.stale</staleFile>
                <xnocompile>true</xnocompile>
                <verbose>true</verbose>
                <extension>true</extension>
                <bindingFiles>
                    <bindingFile>${project.basedir}/src/wsdl/bindings.xjb</bindingFile>
                </bindingFiles>
                <xdebug>true</xdebug>
            </configuration>
        </execution>
    </executions>
</plugin>

and binding file is:

<jaxws:bindings 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"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:ci="http://jaxb.dev.java.net/plugin/code-injector"
                wsdlLocation="mail-service.wsdl"
                jaxb:extensionBindingPrefixes="ci "
                version="2.0"
                jaxb:version="2.1">  

    <jaxb:bindings node="//wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://model.ws.mail.cbt.it']/xs:complexType[@name='mailMessageBean']/xs:sequence/xs:element[@name='subject']">
        <ci:code>
            @Override
            public String toString() { return "bravo filippo";}
        </ci:code>        
    </jaxb:bindings> 
    <!--</jaxws:bindings>--> 
</jaxws:bindings> 

I'm not understanding what is missing or if it's a bug, I tried also with the 2.4.1 version. I really hope you can help me, thank you very much

theit commented 4 years ago

Does this question and possible solution at Stackoverflow help you?