sbrcsr 3.2.0
ATOMAS sbrcsr

Using the CSR API involves

For example (this just uses the request template as is and extracts the response XML)...

Create the CSR object

ato_Ctx *ctx = NULL;
ato_CfgMgr *ctxmgr = NULL;
sbr_Csr *csr = NULL;
sbr_Request *request = NULL;
sbr_Response *response = NULL;
int errcode = ATO_ERR_OK;
: // initialise the SDKs.
errcode = sbr_csr_create(ctx, &csr, "lodge", serviceURL, CsrXmlTemplateBuffer);
if (errcode != ATO_ERR_OK) ; // handle the error
:
#define ATO_ERR_OK
struct _ato_Ctx ato_Ctx
struct _sbr_Request sbr_Request
The CSR request object used to submit a business report.
Definition: request.h:12
struct _sbr_Response sbr_Response
The CSR response object for a given sbr_CsrRequest.
Definition: response.h:12
SBR_CSR_EXPORT int sbr_csr_create(ato_Ctx *ctx, sbr_Csr **csr, const char *servicetype, const char *csrurl, const char *csrtemplate)
Create a CSR object from the XML stored in csrtemplate.
struct _sbr_Csr sbr_Csr
The CSR object used to interact with an SBR core services service to submit business reports.
Definition: include/sbrcsr/csr.h:14

The parameters are:

Note
The csr object must be freed when finished with - after freeing dependant request objects.

Create the CSR Request object

:
errcode = sbr_req_create(ctx, &request, csr);
if (errcode != ATO_ERR_OK) ; // handle the error
:
SBR_CSR_EXPORT int sbr_req_create(ato_Ctx *ctx, sbr_Request **request, sbr_Csr *csr)
Create a CSR request object based on the service type and template information of the CSR object.
Note
The request object must be freed when finished with.

Submit the Request

Prior to submitting a request, there are a variety of methods to set the content of the request. See the API for more details.

:
errcode = sbr_req_submit(ctx, request, &response, certificate, privatekey, prooftoken, encryptedAssertion);
if (errcode != ATO_ERR_OK) ; // handle the error
:
SBR_CSR_EXPORT int sbr_req_submit(ato_Ctx *ctx, sbr_Request *request, sbr_Response **response, ato_String *certificate, ato_String *privatekey, ato_String *prooftoken, ato_String *assertion)
Use a CSR request object to submit to the CSR service and return a CSR response.

The parameters are:

Note
The response object must not be freed. It will be free when the associated request object is freed.

Query the Response

:
errcode = sbr_res_xml(ctx, csrresponse, &buffer);
if (errcode != ATO_ERR_OK) ; // handle the error
:
SBR_CSR_EXPORT int sbr_res_xml(ato_Ctx *ctx, sbr_Response *response, char **buffer)
This is a convenience method to extract the entire response as an XML string.

The parameters are:

There are a variety of other methods to query the response object content. See the API for more details.

Cleanup

:
free(buffer);
sbr_csrreq_free(csrrequest);
SBR_CSR_EXPORT void sbr_csr_free(sbr_Csr *csr)
Free the CSR object if not NULL.