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.
This is an interface pattern, which provides extended control over HTTP connection properties of the Web service client.
● Extension interface name
com.sap.engine.services.webservices.espbase.client.api.HTTPControlInterface
● Factory class name
com.sap.engine.services.webservices.espbase.client.api.HTTPControlFactory
● Interface methods
//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); |
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(); |
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.
● Extension interface name
com.sap.engine.services.webservices.espbase.client.api.SOAPHeaderInterface
● Factory class name
com.sap.engine.services.webservices.espbase.client.api.SOAPHeaderIFactory
● Interface methods
//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; |
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(); |
This is an interface pattern, which enables the Web service client to manage HTTP sessions when consuming Web services that support cookie based sessions.
● Extension interface name
com.sap.engine.services.webservices.espbase.client.api.SessionInterface
● Factory class name
com.sap.engine.services.webservices.espbase.client.api.SessionInterfaceFactory
● Interface methods
//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; |
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 set endpoint url and http option if (sessionInteface.isMaintainSession()) { sessionInterface.closeSession(); sessionInterface.releaseServerResources(); } |