diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-03-02 11:57:53 +0000 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-03-02 11:57:53 +0000 |
commit | 32794e6c8970f4278dbaa2aade0646a2eb8e1aeb (patch) | |
tree | 3d4f9fb3021689afb08c92bc3d3d5dcfef9289ff /lasso/id-wsf-2.0/profile.c | |
parent | 79271d3032e7f7fddd45187333bc0b77991f6d44 (diff) | |
download | lasso-32794e6c8970f4278dbaa2aade0646a2eb8e1aeb.tar.gz lasso-32794e6c8970f4278dbaa2aade0646a2eb8e1aeb.tar.xz lasso-32794e6c8970f4278dbaa2aade0646a2eb8e1aeb.zip |
Core: add an helper method to build a SOAP response in a LassoProfile object
* lasso/id-ff/profile.{c,h}:
add lasso_profile_add_soap_fault_response(char* code, char *string,
GList *details).
* lasso/id-wsf-2.0/profile.{c,h}:
change signature of lasso_idwsf2_profile_init_soap_fault_response.
* lasso/id-wsf-2.0/data_service.c:
use new function instead of manually intializing soap faults
* lasso/id-wsf-2.0/discovery.c:
init a soap fault when parsed request is of an unknown type, return
proper error.
Diffstat (limited to 'lasso/id-wsf-2.0/profile.c')
-rw-r--r-- | lasso/id-wsf-2.0/profile.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/lasso/id-wsf-2.0/profile.c b/lasso/id-wsf-2.0/profile.c index 2a8c1f6f..7f5b2daa 100644 --- a/lasso/id-wsf-2.0/profile.c +++ b/lasso/id-wsf-2.0/profile.c @@ -470,24 +470,28 @@ cleanup: /** * lasso_idwsf2_profile_init_soap_fault_response: * @profile: a #LassoIdWsf2Profile object + * @faultcode: a SOAP fault code, see #LASSO_SOAP_FAULT_CLIENT, #LASSO_SOAP_FAULT_SERVER. + * @faultstring:(allow-none): a human description of the error + * @details:(allow-none)(element-type LassoNode): complementary data describing the error, you can use + * #LassoIdWsf2UtilStatus. * * Initialize a new SOAP 1.1 fault. * * Return value: 0 if successful, an error code otherwise. */ gint -lasso_idwsf2_profile_init_soap_fault_response(LassoIdWsf2Profile *profile) +lasso_idwsf2_profile_init_soap_fault_response(LassoIdWsf2Profile *profile, const char *faultcode, + const char *faultstring, GList *details) { int rc = 0; LassoSoapEnvelope *envelope; - LassoSoapFault *fault; lasso_check_good_rc(lasso_idwsf2_profile_init_response(profile)); + lasso_check_good_rc(lasso_profile_set_soap_fault_response(&profile->parent, faultcode, + faultstring, details)); envelope = lasso_idwsf2_profile_get_soap_envelope_response(profile); if (envelope) { - fault = lasso_soap_fault_new(); - lasso_list_add_new_gobject(envelope->Body->any, fault); - lasso_assign_gobject(profile->parent.response, fault); + lasso_list_add_gobject(envelope->Body->any, profile->parent.response); } cleanup: return rc; @@ -541,10 +545,6 @@ lasso_idwsf2_profile_redirect_user_for_interaction( goto_cleanup_with_rc(LASSO_WSF_PROFILE_ERROR_REDIRECT_REQUEST_UNSUPPORTED_BY_REQUESTER); } - lasso_check_good_rc(lasso_idwsf2_profile_init_soap_fault_response(profile)); - fault = (LassoSoapFault*)profile->parent.response; - lasso_assign_string(fault->faultcode, LASSO_SOAP_FAULT_CODE_SERVER); - lasso_assign_string(fault->faultstring, "Server error"); messageID = lasso_soap_envelope_get_message_id(_get_soap_envelope_response(profile), FALSE); if (! messageID || ! messageID->content) { goto_cleanup_with_rc( @@ -557,13 +557,14 @@ lasso_idwsf2_profile_redirect_user_for_interaction( } redirect_request = lasso_idwsf2_sb2_redirect_request_new_full(url); g_free(url); - lasso_soap_fault_add_to_detail(fault, (LassoNode*)redirect_request); + lasso_check_good_rc(lasso_idwsf2_profile_init_soap_fault_response(profile, + LASSO_SOAP_FAULT_CODE_SERVER, "Server Error", &(GList){ .data = + redirect_request, .next = NULL, .prev = NULL } )); cleanup: if (rc) { LassoIdWsf2UtilStatus *status; const char *status_code = NULL; - lasso_idwsf2_profile_init_soap_fault_response(profile); fault = (LassoSoapFault*)profile->parent.response; lasso_assign_string(fault->faultcode, LASSO_SOAP_FAULT_CODE_SERVER); switch (rc) { @@ -582,9 +583,14 @@ cleanup: } if (status_code) { status = lasso_idwsf2_util_status_new_with_code(status_code, NULL); - fault->Detail = lasso_soap_detail_new(); - lasso_list_add_gobject(fault->Detail->any, status); + lasso_idwsf2_profile_init_soap_fault_response(profile, + LASSO_SOAP_FAULT_CODE_SERVER, NULL, + &(GList){ .data = status, .next = NULL, .prev = NULL}); + } else { + lasso_idwsf2_profile_init_soap_fault_response(profile, + LASSO_SOAP_FAULT_CODE_SERVER, NULL, NULL); } + } lasso_release_gobject(redirect_request); return rc; |