You can set a transport guarantee level to a Web service to secure the data transfer between the Web service and the Web service client.
By using the @TransportGuaranteeDT annotation, you can set any of the transport guarantee levels listed below:
● NONE
The Web service does not require a security constraint. By default, all Web service you create have transport guarantee level NONE.
● INTEGRITY
The Web service requires data transmission which prevents data from being changed in transit.
● confidentiality
The Web service requires data transmission which prevents other entities from observing the contents of the transmission.
● both
A combination of the Integrity and confidentiality transport guarantee levels.
The code sample below shows the use of the annotation to set the transport guarantee level to INTEGRITY:
package com.sap.example;
import javax.ejb.Stateless; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import com.sap.engine.services.webservices.espbase.configuration.ann.dt.TransportGuaranteeDT; import com.sap.engine.services.webservices.espbase.configuration.ann.dt.TransportGuaranteeEnumsLevel;
@WebService(name="MyStatefulImplementationClass", serviceName="MyStatefulImplementationClassService", targetNamespace="http://sap.com/example/", portName="MyStatefulImplementationClassPort") @Stateless //Set transport guarantee level to INTEGRITY for the whole class @TransportGuaranteeDT(level=TransportGuaranteeEnumsLevel.INTEGRITY) public class MyStatefulImplementationClass { @WebMethod(operationName="MyMethod1", exclude=false) public void MyMethod1 (@WebParam(name="newValue1") int newValue1) { //MyMethod1 implementation } @WebMethod(exclude=false, operationName="MyMethod2") public int MyMethod2 (@WebParam(name="arg") int arg) { return arg; } } |
If you want to set any of the other transport guarantee levels, you have to use the @TransportGuaranteeDT annotation with the values of the level attribute corresponding to each level:
● confidentiality
@TransportGuaranteeDT(level=TransportGuaranteeEnumsLevel.confidentiality)
● both
@TransportGuaranteeDT(level=TransportGuaranteeEnumsLevel.BOTH)