Index: fedd/fedd_client.py
===================================================================
--- fedd/fedd_client.py	(revision 8f91e6603f98a3ea85288710c485e5fe6ed5bd04)
+++ fedd/fedd_client.py	(revision 2106ed14eb2203d53888991248ffff30eb48cf2f)
@@ -11,5 +11,6 @@
 from ZSI import SoapWriter
 
-from fedd_util import fedid, fedd_ssl_context, pack_soap, pack_id
+from fedd_util import fedid, fedd_ssl_context, pack_soap, unpack_soap, \
+	pack_id, unpack_id
 
 from optparse import OptionParser, OptionValueError
@@ -108,63 +109,28 @@
 		const=sys.stderr, help="Print SOAP exchange to stderr")
 
-
-
-def print_ID(id, out=sys.stdout, prefix=None, no_nl=False):
-    """Print an ID element (which may have many types) to as a string
-    
-    If out is given, that is the output destination. If prefix is given that
-    string is prepended.  If no_nl is given, the newline is not printed.
-    """
-    # This comprehension selects all accessors from id of the form
-    # get_element_*, calls those in turn and returns a list of non-None ones.
-    # For valid ID elements that will contain exactly one element, which we
-    # print.  Anything else is an error.
-    names = [ getattr(id, method)() for method in dir(id) \
-		    if method.startswith("get_element_") \
-			and callable(getattr(id, method)) 
-			and getattr(id,method)() != None ]
-    if len(names) == 1:
-	if prefix == None: print >>out, names[0],
-	else: print >>out, "%s%s" % (prefix,names[0]),
-	if not no_nl: print >>out
-    else:
-	raise IDFormatException()
-
-
-def print_users(ul, out=sys.stdout):
-    """
-    Print a list of users, with "User: " prepended, one to a line on out.
-    
-    @param ul sequence of user elements
-    @param out output object.  Defaults to sys.stdout
-    """
-    if ul != None:
-	for u in ul:
-	    print_ID(u.get_element_userID(), out, "User: ")
-
-
 def print_response_as_testbed(resp, label, out=sys.stdout):
     """Print the response as input to the splitter script"""
-    emulab_data = { 
-	    "Boss: ": "get_element_boss",
-	    "OpsNode: ": "get_element_ops",
-	    "Domain: ": "get_element_domain",
-	    "FileServer: ": "get_element_fileServer",
-	    "EventServer: ": "get_element_eventServer",
+
+    e = resp['emulab']
+    p = e['project']
+    fields = { 
+	    "Boss": e['boss'],
+	    "OpsNode": e['ops'],
+	    "Domain": e['domain'],
+	    "FileServer": e['fileServer'],
+	    "EventServer": e['eventServer'],
+	    "Project": unpack_id(p['name'])
 	    }
     if (label != None): print >> out, "[%s]" % label
-    e = resp.get_element_emulab()
-    if ( e != None):
-	p = e.get_element_project()
-	if ( p != None ):
-	    print_ID(p.get_element_name(), out, "Project: ")
-	    print_users(p.get_element_user(), out)
-	for k, m in emulab_data.iteritems():
-	    method = getattr(e, m);
-	    if method != None and callable(method):
-		print >> out, "%s%s" % (k, method())
-	for a in e.get_element_fedAttr():
-	    print >>out, "%s: %s" % \
-		    (a.get_element_attribute(), a.get_element_value())
+
+    for l, v in fields.iteritems():
+	print >>out, "%s: %s" % (l, v)
+
+    for u in p['user']:
+	print >>out, "User: %s" % unpack_id(u['userID'])
+
+    for a in e['fedAttr']:
+	print >>out, "%s: %s" % (a['attribute'], a['value'])
+
 def add_ssh_key(option, opt_str, value, parser, access_keys):
     try:
@@ -256,5 +222,5 @@
 	# Yes, doing this on message type is not ideal.  The string comes from
 	# OpenSSL, so check there is this stops working.
-	if e.message == "bad decrypt": 
+	if str(e) == "bad decrypt": 
 	    print >>sys.stderr, "Bad Passphrase given."
 	else: raise
@@ -301,6 +267,5 @@
 	pack_soap(req, "RequestAccessRequestBody", msg))
 
-if opts.debug > 1:
-    print msg
+if opts.debug > 1: print >>sys.stderr, msg
 
 if opts.serialize_only:
@@ -315,9 +280,12 @@
     sys.exit("Fault: %s" % e)
 
+
 if (resp != None):
     resp_body = resp.get_element_RequestAccessResponseBody()
     if ( resp_body != None): 
 	try:
-	    print_response_as_testbed(resp_body, opts.label)
+	    resp_dict = unpack_soap(resp_body)
+	    if opts.debug > 1: print >>sys.stderr, resp_dict
+	    print_response_as_testbed(resp_dict, opts.label)
 	except RuntimeError, e:
 	    sys.exit("Bad response. %s" % e.messgae)
