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>
  • 相关阅读:
    用asp.net(C#)写的论坛
    javascript:window.history.go(1)什么意思啊?
    5个有趣的 JavaScript 代码片段
    marquee属性的使用说明
    flash网站欣赏
    获取验证码程序
    ACCESS中执行sql语句
    靠谱的工程师
    mysql变量(用户+系统)
    理解进程和线程
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/5928951.html
Copyright © 2011-2022 走看看