![]() |
![]() |
![]() |
Lasso Reference Manual | ![]() |
---|---|---|---|---|
#include <lasso/lasso.h> LassoDataService; LassoDataService* lasso_data_service_new (LassoServer *server);gint lasso_data_service_init_query (LassoDataService *service, constchar *select, constchar *item_id, constchar *security_mech_id);LassoDstQueryItem * lasso_data_service_add_query_item (LassoDataService *service, constchar *select, constchar *item_id);gint lasso_data_service_process_query_msg (LassoDataService *service, constchar *message, constchar *security_mech_id);gint lasso_data_service_build_response_msg (LassoDataService *service);gint lasso_data_service_process_query_response_msg (LassoDataService *service, constchar *message);xmlNode * lasso_data_service_get_answer (LassoDataService *service, constchar *select);xmlNode * lasso_data_service_get_answer_for_item_id (LassoDataService *service, constchar *item_id);
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.
typedef struct { LassoWsfProfile parent; LassoDiscoResourceID *resource_id; LassoDiscoEncryptedResourceID *encrypted_resource_id; xmlNode *resource_data; gchar *provider_id; gchar *abstract_description; } LassoDataService;
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. |
gint lasso_data_service_init_query (LassoDataService *service, constchar *select, constchar *item_id, constchar *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. |
LassoDstQueryItem * lasso_data_service_add_query_item (LassoDataService *service, constchar *select, constchar *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 |
gint lasso_data_service_process_query_msg (LassoDataService *service, constchar *message, constchar *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. |
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. |
gint lasso_data_service_process_query_response_msg (LassoDataService *service, constchar *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. |
xmlNode * lasso_data_service_get_answer (LassoDataService *service, constchar *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. |
xmlNode * lasso_data_service_get_answer_for_item_id (LassoDataService *service, constchar *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. |