You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by su...@apache.org on 2007/10/10 14:07:54 UTC

svn commit: r583444 - in /webservices/rampart/scratch/c/saml: include/saml_req.h src/saml_request.c src/saml_responce.c

Author: supun
Date: Wed Oct 10 05:07:54 2007
New Revision: 583444

URL: http://svn.apache.org/viewvc?rev=583444&view=rev
Log:
Applied the 2nd patch from Prasad 

Added:
    webservices/rampart/scratch/c/saml/src/saml_responce.c
Modified:
    webservices/rampart/scratch/c/saml/include/saml_req.h
    webservices/rampart/scratch/c/saml/src/saml_request.c

Modified: webservices/rampart/scratch/c/saml/include/saml_req.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/include/saml_req.h?rev=583444&r1=583443&r2=583444&view=diff
==============================================================================
--- webservices/rampart/scratch/c/saml/include/saml_req.h (original)
+++ webservices/rampart/scratch/c/saml/include/saml_req.h Wed Oct 10 05:07:54 2007
@@ -1,6 +1,22 @@
 #include "SAML.h"
 
-
+#define SAML_REQUESTID		"RequestID"
+#define SAML_SIGNATURE		"Signature"
+#define SAML_SUBJECTQUERY	"SubjectQuery"
+#define SAML_AUTHENTICATIONQUERY	"AuthenticationQuery"
+#define SAML_AUTHDECISIONQUERY	"AuthorizationDecisionQuery"
+#define SAML_ASSERTIONIDREF		"AssertionIDReference"
+#define SAML_ASSERTIONARTIFACT	"AssertionArtifact"
+#define SAML_RESPONDWITH			"RespondWith"
+#define SAML_ATTRDESIGNATOR		"AttributeDesignator"
+#define SAML_RESPONCEID			"ResponceID"
+#define SAML_INRESPONCETO		"InResponseTo"
+#define SAML_RECEPIENT			"Recipient"
+#define SAML_STATUSCODE			"StatusCode"
+#define SAML_STATUSMSG			"StatusMessage"
+#define SAML_STATUSDETAIL		"StatusDetail"
+#define SAML_STATUSVALUE		"Value"
+#define SAML_STATUS				"Status"
 /*A code representing the status of the corresponding request*/
 typedef struct saml_status
 {
@@ -28,7 +44,7 @@
 {
 	saml_subject_t *subject;
 	axis2_char_t *resource;
-	axutil_array_list *attr_desigs;
+	axutil_array_list_t *attr_desigs;
 }saml_attr_query_t;
 
 typedef struct saml_autho_decision_query
@@ -36,7 +52,7 @@
 	saml_subject_t *subject;
 	axis2_char_t *resource;
 	/* One or more saml actions*/
-	axutil_array_list *saml_actions;
+	axutil_array_list_t *saml_actions;
 	saml_evidence_t *evidence;
 
 }saml_autho_decision_query_t;
@@ -80,6 +96,8 @@
 	axis2_char_t *major_version;
 
 	axis2_char_t *minor_version;
+//
+	axis2_char_t *recepient;
 
 	saml_id_t request_responce_id;
 
@@ -89,16 +107,16 @@
 
 	saml_status_t *status;
 
-	axutil_hash_t *saml_assertions;
+	axutil_array_list_t *saml_assertions;
 }saml_responce_t;
 
 AXIS2_EXTERN int AXIS2_CALL saml_request_init(saml_request_t *request, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_request_uninit(saml_request_t *request, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_request_build(saml_request_t *request, axiom_node_t *node, axutil_env_t *env);
 
-AXIS2_EXTERN int AXIS2_CALL saml_responce_init(saml_responce_t *request, axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_responce_init(saml_responce_t *responce, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_responce_uninit(saml_responce_t *responce, axutil_env_t *env);
-AXIS2_EXTERN int AXIS2_CALL saml_responce_build(saml_request_t *request, axiom_node_t *node, axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_responce_build(saml_responce_t *responce, axiom_node_t *node, axutil_env_t *env);
 
 
 AXIS2_EXTERN saml_subject_query_t* AXIS2_CALL saml_subject_query_create(axutil_env_t *env);
@@ -106,18 +124,22 @@
 AXIS2_EXTERN saml_attr_query_t* AXIS2_CALL saml_attr_query_create(axutil_env_t *env);
 AXIS2_EXTERN saml_autho_decision_query_t* AXIS2_CALL saml_autho_decision_query_create(axutil_env_t *env);
 
-AXIS2_EXTERN int AXIS2_CALL saml_subject_query_init(axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_subject_query_init(saml_subject_query_t* subject_query, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_subject_query_build(saml_subject_query_t* subject_query, axiom_node_t *node, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_subject_query_uninit(axutil_env_t *env);
 
-AXIS2_EXTERN int AXIS2_CALL saml_authentication_query_init(axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_authentication_query_init(saml_authentication_query_t *authentication_query, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_authentication_query_build(saml_authentication_query_t* authentication_query, axiom_node_t *node, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_authentication_query_uninit(axutil_env_t *env);
 
-AXIS2_EXTERN int AXIS2_CALL saml_attr_query_init(axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_attr_query_init(saml_attr_query_t* attribute_query, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_attr_query_build(saml_attr_query_t* attribute_query, axiom_node_t *node, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_attr_query_uninit(axutil_env_t *env);
 
-AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_query_init(axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_query_init(saml_autho_decision_query_t* autho_decision_query, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_query_build(saml_autho_decision_query_t* autho_decision_query, axiom_node_t *node, axutil_env_t *env);
 AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_query_uninit(axutil_env_t *env);
+
+AXIS2_EXTERN int AXIS2_CALL saml_status_init(saml_status_t *status, axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_status_uninit(saml_status_t *status, axutil_env_t *env);
+AXIS2_EXTERN int AXIS2_CALL saml_status_build(saml_status_t *status, axiom_node_t *node, axutil_env_t *env);

Modified: webservices/rampart/scratch/c/saml/src/saml_request.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/src/saml_request.c?rev=583444&r1=583443&r2=583444&view=diff
==============================================================================
--- webservices/rampart/scratch/c/saml/src/saml_request.c (original)
+++ webservices/rampart/scratch/c/saml/src/saml_request.c Wed Oct 10 05:07:54 2007
@@ -1,25 +1,6 @@
+#include "saml_req.h"
 
-#define MAJORVERSION	"MajorVersion"
-#define MINORVERSION	"MinorVersion"
-#define REQUESTID		"RequestID"
-#define SIGNATURE		"Signature"
-#define ISSUEINSTANT	"IssueInstant"
-#define SUBJECTQUERY	"SubjectQuery"
-#define AUTHENTICATIONQUERY	"AuthenticationQuery"
-#define AUTHDECISIONQUERY	"AuthorizationDecisionQuery"
-#define ASSERTIONIDREF		"AssertionIDReference"
-#define ASSERTIONARTIFACT	"AssertionArtifact"
-#define RESPONDWITH			"RespondWith"
-#define ARRAY_DEF			4
-#define SUBJECT				"Subject"
-#define AUTHENTICATIONMETHOD "AuthenticationMethod"
-#define RESOURCE			"Resource"
-#define ATTRDESIGNATOR		"AttributeDesignator"
-#define EVIDENCE			"Evidence"
-#define ACTION				"Action"
-
-
-AXIS2_EXTERN saml_subject_query_t* AXIS2_CALL saml_subject_query_create(axutil_env_t *env);
+AXIS2_EXTERN saml_subject_query_t* AXIS2_CALL saml_subject_query_create(axutil_env_t *env)
 {
 	saml_subject_query_t *subject_query = (saml_subject_query_t *)AXIS2_MALLOC(env->allocator, 
 																		sizeof(saml_subject_query_t));
@@ -32,6 +13,13 @@
 	return subject_query;
 }
 
+AXIS2_EXTERN int AXIS2_CALL saml_subject_query_init(saml_subject_query_t *subject_query, axutil_env_t *env)
+{
+	subject_query->subject = NULL:
+	return AXIS2_SUCESS;
+}
+
+
 AXIS2_EXTERN saml_authentication_query_t* AXIS2_CALL saml_authentication_query_create(axutil_env_t *env)
 {
 	saml_authentication_query_t *authentication_query = (saml_authentication_query_t *)AXIS2_MALLOC(env->allocator, 
@@ -43,9 +31,18 @@
 		saml_subject_init(authentication_query->subject, env);
 		authentication_query->auth_method = NULL;
 	}
-	return authentication;
+	return authentication_query;
 }
 
+AXIS2_EXTERN int AXIS2_CALL saml_authentication_query_init(saml_authentication_query_t *authentication_query, 
+																		axutil_env_t *env)
+{
+	authentication_query->auth_method = NULL;
+	authentication_query->subject = NULL;
+	return AXIS2_SUCCESS;
+}
+
+
 AXIS2_EXTERN saml_attr_query_t* AXIS2_CALL saml_attr_query_create(axutil_env_t *env)
 {
 	saml_attr_query_t *attribute_query = (saml_attr_query_t *)AXIS2_MALLOC(env->allocator, sizeof(saml_attr_query_t));
@@ -53,7 +50,7 @@
 	{
 		attribute_query->subject = (saml_subject_t*)AXIS2_MALLOC(env->allocator,
 															sizeof(saml_subject_t));
-		saml_subject_init(authentication_query->subject, env);
+		saml_subject_init(attribute_query->subject, env);
 		
 		attribute_query->attr_desigs = axutil_array_list_create(env, ARRAY_DEF);
 		
@@ -61,6 +58,15 @@
 	return attribute_query;
 }
 
+AXIS2_EXTERN int AXIS2_CALL saml_attr_query_init(saml_attr_query_t* attribute_query, 
+														axutil_env_t *env)
+{
+	attribute_query->attr_desigs = NULL;
+	attribute_query->resource = NULL;
+	attribute_query->subject = NULL;
+	return AXIS2_SUCCESS;
+}
+
 AXIS2_EXTERN saml_autho_decision_query_t* AXIS2_CALL saml_autho_decision_query_create(axutil_env_t *env)
 {
 	saml_autho_decision_query_t *autho_decision_query = (saml_autho_decision_query_t *)AXIS2_MALLOC(env->allocator, sizeof(saml_autho_decision_query_t));
@@ -71,7 +77,8 @@
 															sizeof(saml_subject_t));
 		saml_subject_init(autho_decision_query->subject, env);
 		autho_decision_query->resource = NULL;
-		autho_decision_query->saml_actions = NULL;
+
+		autho_decision_query->saml_actions = axutil_array_list_create(env, ARRAY_DEF);
 
 		autho_decision_query->evidence = (saml_evidence_t*)AXIS2_MALLOC(env->allocator,
 															sizeof(saml_evidence_t));
@@ -82,6 +89,16 @@
 	return autho_decision_query;
 }
 
+AXIS2_EXTERN int AXIS2_CALL saml_autho_decision_query_init(saml_autho_decision_query_t* autho_decision_query, 
+														   axutil_env_t *env)
+{
+	autho_decision_query->evidence = NULL;
+	autho_decision_query->resource = NULL;
+	autho_decision_query->saml_actions = NULL;
+	autho_decision_query->subject = NULL;
+	return AXIS2_SUCCESS;
+}
+
 
 AXIS2_EXTERN int AXIS2_CALL saml_subject_query_build(saml_subject_query_t* subject_query, 
 													 axiom_node_t *node, 
@@ -90,7 +107,7 @@
 {
 
 	axiom_element_t *element = NULL;
-	axiom_children_iterator_t *iterator = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
 	axiom_node_t *child_node;
 	
 	if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT)
@@ -107,13 +124,16 @@
 	
 	if(iterator)
 	{
-		child_node = axiom_child_element_iterator_next(iterator, env);
-        element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
-
-		if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	SUBJECT)))
+		while(axiom_child_element_iterator_has_next(iterator, env))
 		{
-			return 	saml_subject_build(subject_query->subject, element, env);
+			child_node = axiom_child_element_iterator_next(iterator, env);
+			element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+
+			if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_SUBJECT)))
+			{
+				return 	saml_subject_build(subject_query->subject, element, env);
+			}
 		}
 	}
 	else
@@ -128,7 +148,7 @@
 	axutil_hash_t *attr_hash = NULL;
 	axiom_element_t *element = NULL;
 	axutil_hash_index_t *hi = NULL;
-	axiom_children_iterator_t *iterator = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
 	axiom_node_t *child_node;
 	axutil_qname_t *qname;
 
@@ -155,7 +175,7 @@
 			axiom_attribute_t *attr = (axiom_attribute_t*)v;			
 			attr_val = axiom_attribute_get_value(attr, env);
 
-			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), AUTHENTICATIONMETHOD))
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_AUTHENTICATIONMETHOD))
 			{
 				authentication_query->auth_method = attr_val;
 			}
@@ -165,13 +185,17 @@
 	iterator = axiom_element_get_child_elements(element, env, node);
 	if(iterator)
 	{
-		child_node = axiom_child_element_iterator_next(iterator, env);
-        element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
-
-		if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	SUBJECT)))
+		while(axiom_child_element_iterator_has_next(iterator, env))
 		{
-			saml_subject_build(subject_query->subject, element, env);
+		
+			child_node = axiom_child_element_iterator_next(iterator, env);
+			element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+
+			if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																	SAML_SUBJECT)))
+			{
+				saml_subject_build(authentication_query->subject, element, env);
+			}
 		}
 	 
 	}
@@ -188,10 +212,10 @@
 	axutil_hash_t *attr_hash = NULL;
 	axiom_element_t *element = NULL;
 	axutil_hash_index_t *hi = NULL;
-	axiom_children_iterator_t *iterator = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
 	axiom_node_t *child_node;
 	axutil_qname_t *qname;
-
+	saml_action_t *action;
 	if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT)
 	{
 		return AXIS2_FAILURE;
@@ -215,7 +239,7 @@
 			axiom_attribute_t *attr = (axiom_attribute_t*)v;			
 			attr_val = axiom_attribute_get_value(attr, env);
 
-			if(!axuil_strcmp(axiom_attribute_get_localname(attr, env), RESOURCE))
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_RESOURCE))
 			{
 				autho_decision_query->resource = attr_val;
 			}
@@ -240,12 +264,15 @@
 			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
 																		SAML_ACTION)))
 			{
-				
+				action = (saml_action_t*)AXIS2_MALLOC(env->allocator, sizeof(saml_action_t));
+				saml_action_init(action, env);
+				saml_action_build(action, element, env);
+				axutil_array_list_add(autho_decision_query->saml_actions, env, action);
 			}
 			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
 																		SAML_EVIDENCE)))
 			{
-				
+				saml_evidence_build(autho_decision_query->evidence, element, env);
 			}
 		}
 	}
@@ -264,7 +291,7 @@
 	axutil_hash_t *attr_hash = NULL;
 	axiom_element_t *element = NULL;
 	axutil_hash_index_t *hi = NULL;
-	axiom_children_iterator_t *iterator = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
 	axiom_node_t *child_node;
 	axutil_qname_t *qname;
 
@@ -292,7 +319,7 @@
 			axiom_attribute_t *attr = (axiom_attribute_t*)v;			
 			attr_val = axiom_attribute_get_value(attr, env);
 
-			if(!axuil_strcmp(axiom_attribute_get_localname(attr, env), RESOURCE))
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env),SAML_RESOURCE))
 			{
 				attribute_query->resource = attr_val;
 			}
@@ -309,13 +336,13 @@
 			element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
 
 			if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																		SUBJECT)))
+																	SAML_SUBJECT)))
 			{
 				saml_subject_build(attribute_query->subject, element, env);
 			}
 			
 			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																		ATTRDESIGNATOR)))
+																		SAML_ATTRDESIGNATOR)))
 			{
 				saml_attr_desig_t *attr_desig = (saml_attr_desig_t*)AXIS2_MALLOC(env->allocator,
 																			sizeof(saml_attr_desig_t));
@@ -334,6 +361,69 @@
 	
 }
 
+AXIS2_EXTERN int AXIS2_CALL saml_request_init(saml_request_t *request, axutil_env_t *env)
+{
+	request->attribute_query = NULL;
+	request->authentication_query = NULL;
+	request->autho_decision_query = NULL;
+	request->subject_query = NULL;
+	request->issue_instant = NULL;
+	request->major_version = NULL;
+	request->minor_version = NULL;
+	request->saml_artifacts = NULL;
+	request->saml_asserion_id_ref = NULL;
+	request->saml_responds = NULL;
+	request->signature = NULL;
+
+	return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL saml_request_uninit(saml_request_t *request, axutil_env_t *env)
+{
+	if(request->attribute_query)
+	{
+		AXIS2_FREE(env->allocator, request->attribute_query);
+	}
+	if(request->authentication_query)
+	{
+		AXIS2_FREE(env->allocator, request->authentication_query);
+
+	}
+	if(request->autho_decision_query)
+	{
+		AXIS2_FREE(env->allocator, request->autho_decision_query);
+
+	}
+	if(request->subject_query)
+	{
+		AXIS2_FREE(env->allocator, request->subject_query);
+	}
+	if(request->issue_instant)
+	{
+		AXIS2_FREE(env->allocator, request->issue_instant);
+	}
+	if(request->major_version)
+	{
+		AXIS2_FREE(env->allocator, request->major_version);
+	}
+	if(request->minor_version)
+	{
+		AXIS2_FREE(env->allocator, request->minor_version);
+	}
+	if(request->saml_artifacts)
+	{
+		axutil_array_list_free(request->saml_artifacts, env);
+	}
+	if(request->signature)
+	{
+		AXIS2_FREE(env->allocator, request->signature);
+	}
+	if(request->saml_asserion_id_ref)
+	{
+		axutil_array_list_free(request->saml_asserion_id_ref, env);
+	}
+
+}
 
 AXIS2_EXTERN int AXIS2_CALL saml_request_build(saml_request_t *request, 
 											   axiom_node_t *node, 
@@ -342,7 +432,7 @@
 	axutil_hash_t *attr_hash = NULL;
 	axiom_element_t *element = NULL;
 	axutil_hash_index_t *hi = NULL;
-	axiom_children_iterator_t *ci = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
 	axiom_node_t *child_node;
 	axutil_qname_t *qname;
 	if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT)
@@ -368,19 +458,21 @@
 			axiom_attribute_t *attr = (axiom_attribute_t*)v;			
 			attr_val = axiom_attribute_get_value(attr, env);
 
-			if(!axiom_element_get_attribute_value_by_name(attr, env), REQUESTID))
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_REQUESTID))
 			{
 				//to do
+				request->request_id.id = attr_val;
+				 
 			}
-			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), MAJORVERSION))
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_MAJORVERSION))
 			{
 				request->major_version = attr_val;
 			}
-			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), MINORVERSION))
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_MINORVERSION))
 			{
 				request->minor_version = attr_val;
 			}
-			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), ISSUEINSTANT))
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_ISSUEINSTANT))
 			{
 				request->issue_instant = axutil_date_time_create(env);
 				axutil_date_time_deserialize_date(request->issue_instant, env, attr_val);
@@ -396,65 +488,65 @@
 
 	// Request elements
 
-	ci = axiom_element_get_child_elements(element, env, node);
+	iterator = axiom_element_get_child_elements(element, env, node);
 	
-	if(ci)
+	if(iterator)
 	{
-		child_node = axiom_child_element_iterator_next(ci, env);
-        element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
-
-		if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	RESPONDWITH)))
-		{
-			
-			axutil_array_list_add(request->saml_responds, 
-				env, 
-				axiom_element_get_qname(element, env, child_node));
-
-		}
-		else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	SIGNATURE)))
-		{
-			//To do
-		}
-		else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	SUBJECTQUERY)))
+		while(axiom_child_element_iterator_has_next(iterator, env))
 		{
-			request->subject_query = saml_subject_query_create(env);
-			
+		
+			child_node = axiom_child_element_iterator_next(iterator, env);
+			element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
 
+			if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_RESPONDWITH)))
+			{
+				
+				axutil_array_list_add(request->saml_responds, 
+					env, 
+					axiom_element_get_qname(element, env, child_node));
 
-		}
-		else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	AUTHENTICATIONQUERY)))
-		{
-			//To do
-		}
-		else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	AUTHDECISIONQUERY)))
-		{
-			//To do
-		}
-		else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	ASSERTIONIDREF)))
-		{
-			///////////
-		}
-		else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
-																	ASSERTIONARTIFACT)))
-		{
-			axutil_array_list_add(request->saml_artifacts, 
-				env, 
-				axiom_element_get_text(element, env, child_node));
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_SIGNATURE)))
+			{
+				//To do
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_SUBJECTQUERY)))
+			{
+				request->subject_query = saml_subject_query_create(env);
+				saml_subject_query_build(request->subject_query, child_node, env);
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_AUTHENTICATIONQUERY)))
+			{
+				request->authentication_query = saml_authentication_query_create(env);
+				saml_authentication_query_build(request->authentication_query, child_node, env);
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_AUTHDECISIONQUERY)))
+			{
+				request->autho_decision_query = saml_autho_decision_query_create(env);
+				saml_autho_decision_query_build(request->autho_decision_query, child_node, env);
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_ASSERTIONIDREF)))
+			{
+				//To do
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_ASSERTIONARTIFACT)))
+			{
+				//To do
+				axutil_array_list_add(request->saml_artifacts, 
+					env, 
+					axiom_element_get_text(element, env, child_node));
+			}
 		}
 
-
 	}
-	
 
-
-		}
-	}
 	return AXIS2_SUCCESS;
 
 

Added: webservices/rampart/scratch/c/saml/src/saml_responce.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/src/saml_responce.c?rev=583444&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/src/saml_responce.c (added)
+++ webservices/rampart/scratch/c/saml/src/saml_responce.c Wed Oct 10 05:07:54 2007
@@ -0,0 +1,182 @@
+#include "saml_req.h"
+
+
+
+
+
+AXIS2_EXTERN int AXIS2_CALL saml_status_build(saml_status_t *status, 
+											  axiom_node_t *node, 
+											  axutil_env_t *env)
+{
+	
+	axiom_element_t *element = NULL;
+	axiom_element_t *sub_element = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
+	axiom_child_element_iterator_t *child_iterator = NULL;
+	axiom_node_t *child_node;
+	axiom_node_t *sub_node;
+	axis2_char_t *qname = NULL;
+	if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT)
+	{
+		return AXIS2_FAILURE;
+	}
+	
+	if ((element = axiom_node_get_data_element(node, env)) == NULL)
+	{
+		return AXIS2_FAILURE;
+	}
+	
+	iterator = axiom_element_get_child_elements(element, env, node);
+	
+	if(iterator)
+	{
+		while(axiom_child_element_iterator_has_next(iterator, env))
+		{
+		
+			child_node = axiom_child_element_iterator_next(iterator, env);
+			element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+
+			if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_STATUSCODE)))
+			{
+
+				qname = axiom_element_get_attribute_value_by_name(element, env, SAML_STATUSVALUE);
+				if(qname)
+					status->status_value = axutil_qname_create_from_string(env, qname); 
+
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_STATUSMSG)))
+			{
+				status->status_msg = 	axiom_element_get_text(element, env, child_node);
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_STATUSDETAIL)))
+			{
+				/////
+				status->status_detail = 	axiom_element_get_text(element, env, child_node);
+			}
+		}
+	}
+	return AXIS2_SUCCESS;
+
+}
+
+
+
+AXIS2_EXTERN int AXIS2_CALL saml_responce_build(saml_responce_t *responce,
+												axiom_node_t *node, 
+												axutil_env_t *env)
+{
+	axutil_hash_t *attr_hash = NULL;
+	axiom_element_t *element = NULL;
+	axutil_hash_index_t *hi = NULL;
+	axiom_child_element_iterator_t *iterator = NULL;
+	axiom_node_t *child_node;
+	axutil_qname_t *qname;
+	saml_assertion_t *assertion;
+	if (axiom_node_get_node_type(node, env) != AXIOM_ELEMENT)
+	{
+		return AXIS2_FAILURE;
+	}
+	
+	if ((element = axiom_node_get_data_element(node, env)) == NULL)
+	{
+		return AXIS2_FAILURE;
+	}
+	
+	/* initialize the attributes */
+	attr_hash = axiom_element_get_all_attributes(element, env);	
+
+	for (hi = axutil_hash_first(attr_hash, env); hi; hi = axutil_hash_next(env, hi))
+	{
+		void *v = NULL;
+        axutil_hash_this(hi, NULL, NULL, &v);
+		if (v)
+		{
+			axis2_char_t *attr_val = NULL;
+			axiom_attribute_t *attr = (axiom_attribute_t*)v;			
+			attr_val = axiom_attribute_get_value(attr, env);
+
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_RESPONCEID))
+			{
+				//to do
+				responce->responce_id.id =  attr_val;
+			}
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_INRESPONCETO))
+			{
+				//to do
+				responce->request_responce_id.id =  attr_val;
+			}
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_MAJORVERSION))
+			{
+				responce->major_version = attr_val;
+			}
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_MINORVERSION))
+			{
+				responce->minor_version = attr_val;
+			}
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_ISSUEINSTANT))
+			{
+				responce->issue_instant = axutil_date_time_create(env);
+				axutil_date_time_deserialize_date(responce->issue_instant, env, attr_val);
+			}
+			else if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_RECEPIENT))
+			{
+				responce->recepient = attr_val;
+			}
+			else
+			{
+				return 	AXIS2_FAILURE;
+			}
+		
+		}
+	}
+
+
+	// Request elements
+
+	iterator = axiom_element_get_child_elements(element, env, node);
+	
+	if(iterator)
+	{
+		while(axiom_child_element_iterator_has_next(iterator, env))
+		{
+		
+			child_node = axiom_child_element_iterator_next(iterator, env);
+			element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+
+			if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_SIGNATURE)))
+			{
+				//To do
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_STATUS)))
+			{
+				responce->status = (saml_status_t*)AXIS2_MALLOC(env->allocator,
+															sizeof(saml_status_t));
+				if(responce->status)
+				{
+					saml_status_build(responce->status, child_node, env);
+				}
+			}
+			else if(element != NULL && !(axutil_strcmp(axiom_element_get_localname(element, env), 
+																		SAML_ASSERTION)))
+			{
+				assertion = (saml_assertion_t*)AXIS2_MALLOC(env->allocator,
+														sizeof(saml_assertion_t));
+				saml_assertion_init(assertion, env);
+				saml_assertion_build(assertion, child_node, env);
+				axutil_array_list_add(responce->saml_assertions, env, assertion);
+			}
+		
+		}
+
+	}
+
+	return AXIS2_SUCCESS;
+
+
+
+}
\ No newline at end of file