Show TOC Start of Content Area

Background documentation Extended Proxy Capabilities  Locate the document in its SAP Library structure

Use

To extend the control of the applications over the client runtime and its extensions, you can use the following SAP specific interface patterns, which are provided by the client runtime extension model.

HTTP Control Interface

This is an interface pattern, which provides extended control over HTTP connection properties of the Web service client.

      Factory class name

com.sap.engine.services.webservices.espbase.client.api.HTTPControlFactory

Example

ClientSEI port = (ClientSEI) service.getPort(ClientSEI.class);

//Get extension interface

HTTPControlInterface httpInterface = HTTPControlFactory.getInterface(port);

//Use the extension interface to set endpoint url httpInterface.setEndpointURL(“http://myserver.com”);

//Call the web service method

port.callMethod();

      Extension interface name

com.sap.engine.services.webservices.espbase.client.api.HTTPControlInterface

      Interface methods

Syntax

//Sets client socket timeout

void setSocketTimeout(long milliseconds);

// Sets client http proxy server

void setHTTPProxy(String proxyHost, int proxyPort);

// Sets client http proxy basic authentication settings

void setHTTPProxyUserPass(String proxyUser, String proxyPass);

// Sets Keep-Alive flag usage

void setKeepAlive(boolean keepAlive);

// Sets Compress-Response flag usage

void setCompressResponse(boolean compressResponse);

// Adds HTTP header to the request

void addRequesHeader(String headerName, String headerValue);

// Gets HTTP response header value

java.lang.String[] getResponseHeader(String headerName);

// Sets proxy endpoint URL

void setEndpointURL(String url);

 

SOAP Header Interface

This is an interface pattern, which enables consumer applications to set request and get response SOAP headers. The consumer application sets request headers before an operation call, and invokes the methods to get the response headers after the operation call.

      Factory class name

com.sap.engine.services.webservices.espbase.client.api.SOAPHeaderIFactory

Example

ClientSEI port = (ClientSEI) service.getPort(ClientSEI.class);

//Gets extension interface

SOAPHeaderInterface headerInterface = SOAPHeaderIFactory.getInterface(port);

//Uses the extension interface to set endpoint url and http option

headerInterface.setOutputHeader(null,myHeader);

//call the web service method

port.callMethod();

      Extension interface name

com.sap.engine.services.webservices.espbase.client.api.SOAPHeaderInterface

      Interface methods

Syntax

//Returns response SOAP Header using deserialization framework.

java.lang.Object getInputHeader(javax.xml.namespace.QName headerName, Class headerType) throws UnmarshalException;

// Returns response SOAP Header using DOM.

org.w3c.dom.Element getInputHeader(javax.xml.namespace.QName headerName);

// Sets request SOAP header using DOM or serialization framework.

void setOutputHeader(javax.xml.namespace.QName headerName, Object headerContent) throws MarshalException;

 

Session Interface

This is an interface pattern, which enables the Web service client to manage HTTP sessions when consuming Web services that support cookie based sessions.

Note

Note that old SAP JAX-RPC Web service clients by default maintain sessions with the server. However, new JAX-WS Web service clients do not maintain sessions with the server by default. To enable JAX-WS clients to maintain sessions, set the javax.xml.ws.BindingProvider.SESSION_MAINTAIN_PROPERTY to TRUE. The following code example explains the usage of the property:

Example

ClientSEI port = (ClientSEI) service.getPort(ClientSEI.class);

((BindingProvider) port).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);

To disable the default behaviour of SAP JAX-RPC Web service clients and set them to ignore server session cookies, set the session maintain property to FALSE.

Example

ClientSEI port = (ClientSEI) service.getPort(ClientSEI.class);

port._setProperty(javax.xml.rpc.Stub.SESSION_MAINTAIN_PROPERTY, false);

      Factory class name

com.sap.engine.services.webservices.espbase.client.api.SessionInterfaceFactory

Example

ClientSEI port = (ClientSEI) service.getPort(ClientSEI.class);

//Gets extension interface

SessionInterface sessionInterface = SessionInterfaceFactory.getInterface(port);

//call the web service method

port.callMethod();

//Uses the extension interface to check if session is maintained with the server

if (sessionInteface.isMaintainSession()) {

   //Closes the session with the server

   sessionInterface.closeSession();

   //Releases session resources (SAP specific for AS ABAP endpoints)

   sessionInterface.releaseServerResources();

   }

      Extension interface name

com.sap.engine.services.webservices.espbase.client.api.SessionInterface

      Interface methods

Syntax

//Returns true if session is open with the server

boolean isMaintainSession();

// Ends current session

void closeSession();

// For releasing of session resources - valid method on SAP endpoints only.

void releaseServerResources() throws RemoteException;

 

LoggingManagement Interface

By default, the system logs errors that occur on the provider and consumer sides. The system records these errors in trace files and then in a database. To decrease load on the database and to keep the trace files empty of expected errors, thereby increasing system performance, you can disable logging on the consumer side.

You use this interface pattern to disable the default logging and storing error call entries on the consumer side.

      Factory class name

com.sap.engine.services.webservices.espbase.client.api.LoggingManagementFactory

Example

import com.sap.engine.services.webservices.espbase.client.api.LoggingManagementFactory;

import com.sap.engine.services.webservices.espbase.client.api.LoggingManagementInterface;

LoggingManagementInterface loggingInt = LoggingManagementFactory.getInterface(port);

loggingInt.suppressErrorCauseLogging(true);

loggingInt.isErrorCauseLoggingSuppressed();

      Extension interface name

com.sap.engine.services.webservices.espbase.client.api.LoggingManagementInterface

      Interface methods

Syntax

//Activates or deactivates logging on the client side

boolean suppressErrorCauseLogging();

// Gets logging status on the client side

boolean isErrorCauseLoggingSuppressed();

 

 

End of Content Area