|
Oracle Communications Converged Application Server Java API Reference 5.1 E36938-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
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 |
---|
XcapRoot getXcapRoot()
XcapResponse send(XcapRequest request) throws XcapException
request
- XCAP request to be send by this XCAP Client.com.oracle.sft.xcap.client.ericsson.ims.jee.xcap.XcapException
- in case the XCAP Server cannot be reached.XcapException
to obtain a request.
void setValidation(boolean flag)
flag
- true to do validation, otherwise, false.void setCredentials(String userName, String password)
userName
- the user namepassword
- the password, char ":" can not be used in password.
|
Oracle Communications Converged Application Server Java API Reference 5.1 E36938-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2012 Oracle Corporation. All Rights Reserved.