grouper-users - RE: Help with accessing web services
Subject: Grouper Users - Open Discussion List
List archive
- From: Paul Gazda <>
- To: "" <>
- Subject: RE: Help with accessing web services
- Date: Fri, 13 Feb 2009 09:58:20 -0700
- Accept-language: en-US
- Acceptlanguage: en-US
Hi Chris. Thanks for the great help on how to access web services from
within a java program. Your example worked great. I am now venturing out and
trying to do a GroupSave using the GrouperClient.java code as a guide. The save
operation works, but if I try to save a group name that already exists and get
an error message, I want to be able to determine that the error was due to the
group already existing rather than some other reason. I have been unable to
determine this from the error message that is returned. I set saveMode = "INSERT" because I do not want to
modify an existing group if it exists. If the group already exists, I get this
error message: Grouper error attempting to save group. edu.internet2.middleware.grouperClient.ws.GcWebServiceError:
Bad response from web service: resultCode:
PROBLEM_SAVING_GROUPS, There were 0 successes and 1 failures of saving
groups. java.lang.RuntimeException: java.lang.RuntimeException: Must not pass in a name for an
insert, Problem in HibernateSession: HibernateSession: isNew: false, isReadonly: false, grouperTransactionType:
READ_WRITE_NEW, Problem in HibernateSession: HibernateSession: isNew: true, isReadonly: false, grouperTransactionType:
READ_WRITE_NEW I do not see anything in the error message that tells me the
group already exists. e.getMessage() does not give me any different information. Is there a way I can tell if the GroupSave failure is due to
the group already existing? Thanks. Paul Gazda From: Chris Hyzer
[mailto:] I think the easiest
and best way to use grouper web services by code is to use the grouper client
API. Here is an example below that I tested and it works. All the
configuration is in the grouper.client.properties file, and you only need the
grouperClient.jar. Here are the classes you should be using: Here are all the
underlying beans: Full javadoc: http://middleware.internet2.edu/dir/groups/grouper/grouper/1.4.1/gc/api/index.html Here are example grouper
client calls: That said, I need to
put more examples on the grouper client website, if you need help doing
something, let me know and I can beef up the docs. Your other code
either needs all the dependent jars, or to use the classes in the classpath of
the grouperClient.jar. I took in a minimal number of 3rd party
jars into the grouper client jar, and changed their classpath so nothing
conflicts. I wanted this to be very easy for non java people to use, so
it is one jar and one config file, and an easy command line. Java is not
as easy to kick off with multiple jars, and less easy to upgrade
etc… there are disadvantages here (like your confusion), but I
think the pros outweigh the cons. Regards, Chris /* * @author mchyzer * $Id$ */ package edu.internet2.middleware.grouperClient.poc; import edu.internet2.middleware.grouperClient.api.GcFindStems; import
edu.internet2.middleware.grouperClient.ws.beans.WsFindStemsResults; import edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta; import edu.internet2.middleware.grouperClient.ws.beans.WsStem; import
edu.internet2.middleware.grouperClient.ws.beans.WsStemQueryFilter; /** * */ public class FindStem { /** * @param args */ public static void main(String[] args) { GcFindStems gcFindStems = new
GcFindStems(); WsStemQueryFilter wsStemQueryFilter = new WsStemQueryFilter(); wsStemQueryFilter.setStemName("penn"); wsStemQueryFilter.setStemQueryFilterType("FIND_BY_STEM_NAME_APPROXIMATE");
gcFindStems.assignStemQueryFilter(wsStemQueryFilter); WsFindStemsResults wsFindStemsResults =
gcFindStems.execute(); WsResultMeta resultMetadata = wsFindStemsResults.getResultMetadata(); if (!"T".equals(resultMetadata.getSuccess())) { throw new RuntimeException("Error finding stems: " + resultMetadata.getSuccess() + ", " + resultMetadata.getResultCode() + ", " + resultMetadata.getResultMessage()); } WsStem[] wsStems =
wsFindStemsResults.getStemResults(); if (wsStems != null) { for (WsStem wsStem : wsStems) { System.out.println(wsStem.getName()); } } } } |
- Help with accessing web services, Paul Gazda, 02/04/2009
- RE: Help with accessing web services, Chris Hyzer, 02/04/2009
- RE: Help with accessing web services, Paul Gazda, 02/13/2009
- RE: Help with accessing web services, Chris Hyzer, 02/18/2009
- RE: Help with accessing web services, Paul Gazda, 02/18/2009
- RE: Help with accessing web services, Chris Hyzer, 02/18/2009
- RE: Help with accessing web services, Chris Hyzer, 02/20/2009
- RE: Help with accessing web services, Paul Gazda, 02/25/2009
- RE: Help with accessing web services, Chris Hyzer, 02/25/2009
- RE: Help with accessing web services, Paul Gazda, 02/27/2009
- RE: Help with accessing web services, Chris Hyzer, 02/27/2009
- RE: Help with accessing web services, Paul Gazda, 02/27/2009
- RE: Help with accessing web services, Chris Hyzer, 02/27/2009
- RE: Help with accessing web services, Paul Gazda, 02/25/2009
- RE: Help with accessing web services, Paul Gazda, 02/18/2009
- RE: Help with accessing web services, Chris Hyzer, 02/18/2009
- RE: Help with accessing web services, Paul Gazda, 02/13/2009
- RE: Help with accessing web services, Chris Hyzer, 02/04/2009
Archive powered by MHonArc 2.6.16.