grouper-users - [grouper-users] groupSave using REST web services
Subject: Grouper Users - Open Discussion List
List archive
- From: Erik Froese <>
- To:
- Subject: [grouper-users] groupSave using REST web services
- Date: Tue, 22 Mar 2011 18:57:05 -0400
Hey all,
I'm trying to create a group using the REST WS and a JSON request.
I stole a lot of the code from the example:
http://anonsvn.internet2.edu/cgi-bin/viewvc.cgi/i2mi/trunk/grouper-ws/grouper-ws/src/test/edu/internet2/middleware/grouper/ws/samples/rest/group/WsSampleGroupSaveRest.java?revision=5539&view=co
I'm just adding 1 group to the request, serializing it as a JSON
String, and sending it off. Apparently grouper isn't liking what I'm
doing.
// Fill out the group save request beans
WsRestGroupSaveRequest groupSave = new WsRestGroupSaveRequest();
WsGroupToSave wsGroupToSave = new WsGroupToSave();
wsGroupToSave.setWsGroupLookup(new WsGroupLookup(fullGrouperName, null));
WsGroup wsGroup = new WsGroup();
wsGroup.setDescription("Created by Sakai3");
wsGroup.setDisplayExtension(grouperName);
wsGroup.setExtension(grouperName);
wsGroup.setName(fullGrouperName);
wsGroupToSave.setWsGroup(wsGroup);
groupSave.setWsGroupToSaves(new WsGroupToSave[]{ wsGroupToSave });
The JSON request looks like this:
{"wsGroupToSaves":[{"wsGroup":{"description":"Created by
Sakai3","displayExtension":"test12","extension":"test12","name":"nyu:apps:atlas:test12"},"wsGroupLookup":{"groupName":"nyu:apps:atlas:test12"}}]}.
And I'm getting an error on the WS server that indicates it found an
invalid request type.
2011-03-22 18:43:19,453: [http-8080-5] ERROR
GrouperRestServlet.service(204) - - Problem with request: uri:
/grouper-ws/servicesRest/1_6_003/groups, method: POST, decoded url
strings: 0: '1_6_003', 1: 'groups'
java.lang.RuntimeException: Problem unparsing string with converter:
edu.internet2.middleware.grouper.ws.rest.json.DefaultJsonConverter, {
"wsGroupToSaves":[
{
"wsGroup":{
"description":"Created by Sakai3",
"displayExtension":"test12",
"extension":"test12",
"name":"nyu:apps:atlas:test12"
},
"wsGroupLookup":{
"groupName":"nyu:apps:atlas:test12"
}
}
]
}
...
Caused by: java.lang.RuntimeException: Not allowed to unmarshal json:
wsGroupToSaves, {"wsGroupToSaves":[{"wsGroup":{"description":"Created
by
Sakai3","displayExtension":"test12","extension":"test12","name":"nyu:apps:atlas:test12"},"wsGroupLookup":{"groupName":"nyu:apps:atlas:test12"}}]}
This indicates that WsGroupsToSaves is not present in the
conversionMap that maps request type names to beans for
de-serialization.
Indeed edu.internet2.middleware.grouper.ws.rest.WsRestClassLookup
doens't seem to have a match for wsGroupToSaves.
Any pointers as to how to make this read wsGroupToSave instead of
wsGroupToSaves? Is that necessary?
Erik
- [grouper-users] groupSave using REST web services, Erik Froese, 03/22/2011
- RE: [grouper-users] groupSave using REST web services, Chris Hyzer, 03/22/2011
- Re: [grouper-users] groupSave using REST web services, Erik Froese, 03/23/2011
- RE: [grouper-users] groupSave using REST web services, Chris Hyzer, 03/22/2011
Archive powered by MHonArc 2.6.16.