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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM