Ejemplo n.º 1
0
 public Group updateGroupAsJSON(string gid, Group group)
 {
     return updateGroup(gid, group);
 }
Ejemplo n.º 2
0
 public Group createGroupAsJSON(Group group)
 {
     return createGroup(group);
 }
Ejemplo n.º 3
0
 public Group updateGroup(string gid, Group group)
 {
     return null;
 }
Ejemplo n.º 4
0
 public Group createGroupAsXML(Group group)
 {
     return createGroup(group);
 }
Ejemplo n.º 5
0
 public Group createGroup(Group group)
 {
     return null;
 }
Ejemplo n.º 6
0
        public WebResponse updateGroup(Group group, string requestType, string responseType)
        {
            // create a resource to update the group
            Uri uri = new Uri(url + "/Group/" + group.id);
            WebRequest request = WebRequest.Create(uri);

            // set the request & response media types
            request.ContentType = requestType;
            request.Headers.Add("Accept: " + responseType);

            // get the request stream to write the group
            Stream stream = request.GetRequestStream();

            // create a user serializer
            XmlSerializer serializer = new XmlSerializer(typeof(Group));

            // serialize the group object to xml
            serializer.Serialize(stream, group);

            // send the create group request to the rest resource
            request.Method = "POST";
            WebResponse response = request.GetResponse();

            return response;
        }
Ejemplo n.º 7
0
 public WebResponse updateGroup(Group group)
 {
     return updateGroup(group, APPLICATION_XML_TYPE, APPLICATION_XML_TYPE);
 }
Ejemplo n.º 8
0
        public static String createGroupTest(Client client)
        {
            // create a test group
            Group group = new Group();
            group.id = "gid=nerds,ou=groups,dc=hackerypokery,dc=com";

            // send the request to create the group
            WebResponse response = client.createGroup(group);

            // verify the response code indicates success
            //int status =  response.getStatusCode();
            //assert(status == 201);

            // retrieve the location of the group
            //String location = response.getHeaders().getFirst("Location");	    

            // get the response stream to read the group
            Stream stream = response.GetResponseStream();

            // create a group deserializer
            XmlSerializer deserializer = new XmlSerializer(typeof(Group));

            // retrieve the returned group entry
            group = (Group)deserializer.Deserialize(stream);

            Console.WriteLine("created group - " + group.id);

            return group.id;
        }