码迷,mamicode.com
首页 > 其他好文 > 详细

CXF支持 SOAP1.1 SOAP1.2协议

时间:2016-10-03 12:39:10      阅读:780      评论:0      收藏:0      [点我收藏+]

标签:

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>

CXF支持 SOAP1.1 SOAP1.2协议

标签:

原文地址:http://www.cnblogs.com/yg_zhang/p/5928951.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!