zoukankan      html  css  js  c++  java
  • CXF支持 SOAP1.1 SOAP1.2协议

    SOAP协议分为两个版本 1.1 1.2

    默认支持1.1

     

    实现方式:

     

    1.编写接口

     

    import javax.jws.WebService;
    
    @WebService
    public interface ISerivceTest {
        String sayHello(String name);
    }

    2.编写实现方式

    import javax.jws.WebService;
    import javax.xml.ws.BindingType;
    import javax.xml.ws.soap.SOAPBinding;
    
    import com.hotent.mini.ext.service.ISerivceTest;
    
    @WebService(serviceName="HelloWorld")
    @BindingType(value =SOAPBinding.SOAP12HTTP_BINDING)
    public class ServiceTestImpl implements ISerivceTest {
    
        @Override
        public String sayHello(String name) {
            return "hello:" + name;
        }
    
    }

    注意这个需要写在实现类上。

     

    3.需要增加类

    <dependency>  
                <groupId>org.apache.geronimo.specs</groupId>  
                <artifactId>geronimo-jaxws_2.2_spec</artifactId>  
                <version>1.0</version>  
            </dependency>

     

    4.soap 包格式

     

    soap1.1

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ext.mini.hotent.com/">
       <soapenv:Header/>
       <soapenv:Body>
          <ser:sayHello>
             <!--Optional:-->
             <arg0>?</arg0>
          </ser:sayHello>
       </soapenv:Body>
    </soapenv:Envelope>

    soap1.2

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://service.ext.mini.hotent.com/">
       <soap:Header/>
       <soap:Body>
          <ser:sayHello>
             <!--Optional:-->
             <arg0>dddd</arg0>
          </ser:sayHello>
       </soap:Body>
    </soap:Envelope>
  • 相关阅读:
    洛谷 P1092 虫食算
    2018.3.25校内互测
    洛谷 P2915 [USACO08NOV]奶牛混合起来Mixed Up Cows
    洛谷 P1879 [USACO06NOV]玉米田Corn Fields
    洛谷 P3052 [USACO12MAR]摩天大楼里的奶牛Cows in a Skyscraper
    ZJOI Day 2 游记
    editorial-render A
    BZOJ2904
    BZOJ 1600
    构造脚本语言
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/5928951.html
Copyright © 2011-2022 走看看