How to use WSDL with spring-boot?

前端 未结 5 2053
臣服心动
臣服心动 2020-12-25 14:48

I have WSDL and schema files provided by client. I need to create Spring-boot SOAP web service with this WSDL file. I have google it and all the examples that I can find, th

5条回答
  •  眼角桃花
    2020-12-25 15:29

    The easiest way is to simply use the cxf-spring-boot-starter incl. it's companion Maven plugin, they will take care of generating mostly everything needed from your wsdl and schema files. Here's a full example: https://github.com/codecentric/spring-samples/tree/master/cxf-boot-simple.

    Using the starter in your pom.xml, you just have to place the wsdl & schema files in src/main/resources and you're mostly done. Here's a full example pom.xml:

    
    
        4.0.0
    
        de.codecentric.soap
        cxf-boot-simple
        2.0.0-SNAPSHOT
        jar
    
        cxf-boot-simple
        Demo project for using Spring Boot Starter CXF
    
        
            org.springframework.boot
            spring-boot-starter-parent
            2.1.2.RELEASE
        
    
        
            UTF-8
            1.8
        
    
        
            
                de.codecentric
                cxf-spring-boot-starter
                2.1.2.RELEASE
            
            
                org.springframework.boot
                spring-boot-starter-test
                test
            
        
    
        
            
                
                    org.springframework.boot
                    spring-boot-maven-plugin
                
                
                    de.codecentric
                    cxf-spring-boot-starter-maven-plugin
                    2.0.0.RELEASE
                    
                        
                            
                                generate
                            
                        
                    
                
            
        
    
    

提交回复
热议问题