wsimport - how to generate service endpoint classes and JAXB classes in separate projects/folders

前端 未结 4 872
清酒与你
清酒与你 2020-12-16 00:49

We are using a top-down approach for a project with multiple web services (multiple WSDL\'s). Each web service needs to be set up as a separate project and deployed as a sep

4条回答
  •  隐瞒了意图╮
    2020-12-16 01:36

    You can achieve this using JAXB/JAX-WS customization. Suppose you have XSD types embedded into WSDL. Then your customization will look like:

    
    
        
    
        
        
            
                
            
        
    
    

    The above configuration refers the following project directory structure:

    +-- binding
    |   +-- jaxws-binding.xml
    +-- wsdl
    |   +-- some.wsdl
    +-- src
        ...
    

    If you use org.codehaus.mojo:jaxws-maven-plugin plugin, then you need to specify binding.

    In case your XSD is external to WSDL, then you need to specify customizations separately:

    +-- binding
    |   +-- jaxb-binding.xml
    |   +-- jaxws-binding.xml
    +-- wsdl
        ...
    

    Then jaxb-binding.xml will look like:

    
    
        
            
                
            
        
    
    
    • For Ant build you simply generate two jars for different packages.
    • As I personally do not know any way to create two JAR artefacts from one Maven project :) then the most simple solution would be for you to generate JAXB classes from XSD in project-beans project and in project-ws project remove generated JAXB classes after wsimport run (you can use ant plugin for that).

提交回复
热议问题