Skip navigation links

Oracle Communications Converged Application Server Java API Reference
5.1

E36938-01


com.oracle.sft.xcap.client
Interface XcapConnection


public interface XcapConnection

Representation of an XCAP client. Responsibilities include:

The implementation SHOULD NOT depend on any implementation specific methods or fields of the implemementation of the interfaces in this package.

If setValidation(true), request payload data are validated according to the xml schema before the request is sent. The validation is only for SYNC operation of XcapRequest. When validating, whole document where a specific element/attribute is hosted is validated, not just the element/attribute itself. For example, SYNC a SupportedMediaType (a "serv-cap-media" element) resource, the whole document below is validated.

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <simservs xmlns="http://uri.etsi.org/ngn/params/xml/simservs/xcap"
     xmlns:ns2="urn:ietf:params:xml:ns:common-policy" xmlns:ns3="urn:oma:xml:xdm:common-policy">
     <communication-barring-serv-cap>
         <serv-cap-conditions>
             <serv-cap-media>
                 <all-media />
                 <no-media />
             </serv-cap-media>
         </serv-cap-conditions>
     </communication-barring-serv-cap>
 </simservs>
 

Considering security, program can be written as below to interact with server.

    // prepare XcapRequest
    String xui = "bob@example.com";
    XcapDocumentSelector dSelector = xcapClient.createDocumentSelector(SimServsDocument.AUID, xui, SimServsDocument.FILENAME);
    SimServsDocument document = xcapClient.createDocument(dSelector, SimServsDocument.MIMETYPE);
    ...
    XcapRequest request = xcapClient.createRequest(document, XcapRequest.Operation.SYNC);
    // create XcapConnection
    XcapRoot xcapRoot = xcapClient.createXcapRoot("http://xcap.example.com/);
    XcapConnection conn = xcapClient.createConnection(xcapRoot);
    // set ssecurity information
    conn.setKeystoreInfo("C:\\ServerCert\\ClientIdentity.jks", "JKS", "storepass", "keypass");
    conn.setTruststoreInfo("C:\\ServerCert\\DemoTrust.jks", "JKS", "DemoTrustKeyStorePassPhrase");
    conn.setUserName("yourUsername");
    conn.setPassword("yourPassword");
    ...
    conn.addHeader(yourHeaderName, yourHeaderValue);
    // send the request
    XcapResponse resp = conn.send(request);
    // handle the response
    ...
 

XcapConnection instances are not thread safe.

See Also:
to obtain a client.

Method Summary
 XcapRoot getXcapRoot()
          Get XCAP root.
 XcapResponse send(XcapRequest request)
          Sends an XCAP request to the server.
 void setCredentials(String userName, String password)
          Set user name and password for BASIC/DIGEST authentication.
 void setValidation(boolean flag)
          Set whether validate the payload data before sending request.

 

Method Detail

getXcapRoot

XcapRoot getXcapRoot()
Get XCAP root.
Returns:
The XCAP root.

send

XcapResponse send(XcapRequest request)
                  throws XcapException
Sends an XCAP request to the server.
Parameters:
request - XCAP request to be send by this XCAP Client.
Returns:
response as received from the XCAP Server.
Throws:
com.oracle.sft.xcap.client.ericsson.ims.jee.xcap.XcapException - in case the XCAP Server cannot be reached.
XcapException
See Also:
to obtain a request.

setValidation

void setValidation(boolean flag)
Set whether validate the payload data before sending request. If the flag is not set, the default behavior is not to do validation.
Parameters:
flag - true to do validation, otherwise, false.

setCredentials

void setCredentials(String userName,
                    String password)
Set user name and password for BASIC/DIGEST authentication.
Parameters:
userName - the user name
password - the password, char ":" can not be used in password.

Skip navigation links

Oracle Communications Converged Application Server Java API Reference
5.1

E36938-01


Copyright © 2012 Oracle Corporation. All Rights Reserved.