LassoDataService

LassoDataService — ID-WSF Data Service profile

Synopsis


#include <lasso/lasso.h>

                    LassoDataService;
LassoDataService*   lasso_data_service_new              (LassoServer *server);
LassoDataService*   lasso_data_service_new_full         (LassoServer *server,
                                                         LassoDiscoResourceOffering *offering);
gint                lasso_data_service_init_query       (LassoDataService *service,
                                                         const char *select,
                                                         const char *item_id,
                                                         const char *security_mech_id);
LassoDstQueryItem*  lasso_data_service_add_query_item   (LassoDataService *service,
                                                         const char *select,
                                                         const char *item_id);
gint                lasso_data_service_process_query_msg
                                                        (LassoDataService *service,
                                                         const char *message,
                                                         const char *security_mech_id);
gint                lasso_data_service_build_response_msg
                                                        (LassoDataService *service);
gint                lasso_data_service_process_query_response_msg
                                                        (LassoDataService *service,
                                                         const char *message);
xmlNode*            lasso_data_service_get_answer       (LassoDataService *service,
                                                         const char *select);
xmlNode*            lasso_data_service_get_answer_for_item_id
                                                        (LassoDataService *service,
                                                         const char *item_id);

Object Hierarchy

  GObject
   +----LassoNode
         +----LassoWsfProfile
               +----LassoDataService

Description

DataService allows Attribute Consumers (WSC) to request an Attribute Provider (WSP) to get or modify data about users with their consent.

Following up on LassoDiscovery first example, it created a service object, this is a LassoDataService instance. This example continues from that step and retrieves the name of the principal:

char *soap_answer;            // SOAP answer from data service
xmlNode *principal_name;      // libxml2 xmlNode with the principal name

service = lasso_discovery_get_service(discovery);
lasso_data_service_init_query(service, "/pp:PP/pp:InformalName", NULL);
lasso_data_service_build_request_msg(service);

// service must perform SOAP call to LASSO_WSF_PROFILE(service)->msg_url
// the SOAP message is LASSO_WSF_PROFILE(service)->msg_body.  The answer
// is stored in char* soap_answer;

lasso_data_service_process_query_response_msg(service, soap_answer);
principal_name = lasso_data_service_get_answer(service, "/pp:PP/pp:InformalName");

// app should probably then use xmlNodeGetContent libxml2 function to get
// access to node content.

Details

LassoDataService

typedef struct {
	LassoDiscoResourceID *resource_id;
	LassoDiscoEncryptedResourceID *encrypted_resource_id;
	xmlNode *resource_data;

	gchar *provider_id;
	gchar *abstract_description;
} LassoDataService;


lasso_data_service_new ()

LassoDataService*   lasso_data_service_new              (LassoServer *server);

Creates a new LassoDataService.

server :

the LassoServer

Returns :

a newly created LassoDataService object; or NULL if an error occured.

lasso_data_service_new_full ()

LassoDataService*   lasso_data_service_new_full         (LassoServer *server,
                                                         LassoDiscoResourceOffering *offering);

Creates a new LassoDataService.

server :

the LassoServer

offering :

the LassoDiscoResourceOffering

Returns :

a newly created LassoDataService object; or NULL if an error occured.

lasso_data_service_init_query ()

gint                lasso_data_service_init_query       (LassoDataService *service,
                                                         const char *select,
                                                         const char *item_id,
                                                         const char *security_mech_id);

Initializes a new dst:Query request, asking for element select (with optional itemID set to item_id). item_id may be NULL only if the query won't contain other query items.

If both select and item_id are NULL, only a skeleton request is created and calls to lasso_data_service_add_query_item() will need to be done.

service :

a LassoDataService

select :

resource selection string (typically a XPath query)

item_id :

query item identifier (optional)

security_mech_id :

Returns :

0 on success; or a negative value otherwise.

lasso_data_service_add_query_item ()

LassoDstQueryItem*  lasso_data_service_add_query_item   (LassoDataService *service,
                                                         const char *select,
                                                         const char *item_id);

Adds a dst:QueryItem to the current dst:Query request.

service :

a LassoDataService

select :

resource selection string (typically a XPath query)

item_id :

query item identifier

Returns :

a newly created LassoDstQueryItem with the query item that has been created. Note that it is internally allocated and shouldn't be freed by the caller.

lasso_data_service_process_query_msg ()

gint                lasso_data_service_process_query_msg
                                                        (LassoDataService *service,
                                                         const char *message,
                                                         const char *security_mech_id);

Processes a dst:Query message. Rebuilds a request object from the message and extracts ResourceID.

service :

a LassoDataService

message :

the dst query message

security_mech_id :

Returns :

0 on success; or a negative value otherwise.

lasso_data_service_build_response_msg ()

gint                lasso_data_service_build_response_msg
                                                        (LassoDataService *service);

Builds a dst:QueryResponse message.

service :

a LassoDataService

Returns :

0 on success; or a negative value otherwise.

lasso_data_service_process_query_response_msg ()

gint                lasso_data_service_process_query_response_msg
                                                        (LassoDataService *service,
                                                         const char *message);

Processes a dst:Query message. Rebuilds a request object from the message and extracts ResourcedID.

service :

a LassoDataService

message :

the dst query response message

Returns :

0 on success; or a negative value otherwise.

lasso_data_service_get_answer ()

xmlNode*            lasso_data_service_get_answer       (LassoDataService *service,
                                                         const char *select);

Returns the answer for the specified select request.

service :

a LassoDataService

select :

resource selection string (typically a XPath query)

Returns :

the node (libxml2 xmlNode*); or NULL if it was not found. This xmlnode must be freed by caller.

lasso_data_service_get_answer_for_item_id ()

xmlNode*            lasso_data_service_get_answer_for_item_id
                                                        (LassoDataService *service,
                                                         const char *item_id);

Returns the answer for the specified item_id query item.

service :

a LassoDataService

item_id :

query item identifier

Returns :

the node (libxml2 xmlNode*); or NULL if it was not found. This xmlnode must be freed by caller.