Index: fedd/federation/remote_service.py
===================================================================
--- fedd/federation/remote_service.py	(revision bdf00d50e7163076a8f5de167cde3d9a98df46be)
+++ fedd/federation/remote_service.py	(revision 2ee4226b9e0583993240989328c6c406b2a06c45)
@@ -345,9 +345,4 @@
 	# basic string if it isn't one already.
 	r = self.strip_unicode(copy.deepcopy(req))
-	url = str(url)
-	
-	transport = SSL_Transport(ctx)
-	port = ServerProxy(url, transport=transport)
-	# Make the call, and convert faults back to service_errors
 	if self.request_body_name:
 	    r  = self.apply_to_tags(\
@@ -356,4 +351,5 @@
 	    r = self.apply_to_tags(r, self.encap_fedids)
 
+	url = str(url)
 	ok = False
 	retries = 0
@@ -361,4 +357,6 @@
 	while not ok and retries < self.max_retries:
 	    try:
+		transport = SSL_Transport(ctx)
+		port = ServerProxy(url, transport=transport)
 		remote_method = getattr(port, self.service_name, None)
 		resp = remote_method(r)
@@ -405,43 +403,56 @@
 		    "Call to soap service without a configured request body");
 
-	# If a context is given, use it.  Otherwise construct one from
-	# components.  The construction shouldn't call out for passwords.
-	if context:
-	    ctx = context
-	else:
-	    try:
-		ctx = fedd_ssl_context(cert_file, trusted_certs, 
-			password=cert_pwd)
-	    except SSL.SSLError:
-		raise service_error(service_error.server_config,
-			"Certificates misconfigured")
-	loc = self.locator()
-	get_port = getattr(loc, self.port_name, None)
-	if not get_port:
-	    raise service_error(service_error.internal, 
-		    "Cannot get port %s from locator" % self.port_name)
-	port = get_port(url,
-		transport=M2Crypto.httpslib.HTTPSConnection, 
-		transdict={ 'ssl_context' : ctx },
-		tracefile=tf)
-	remote_method = getattr(port, self.service_name, None)
-	if not remote_method:
-	    raise service_error(service_error.internal,
-		    "Cannot get service from SOAP port")
-
-	# Reconstruct the full request message
-	msg = self.request_message()
-	set_element = getattr(msg, "set_element_%s" % self.request_body_name,
-		None)
-	if not set_element:
-	    raise service_error(service_error.internal,
-		    "Cannot get element setting method for %s" % \
-			    self.request_body_name)
-	set_element(self.pack_soap(msg, self.request_body_name, req))
 	ok = False
 	retries = 0
 	while not ok and retries < self.max_retries:
 	    try:
+		# Reconstruct the full request message
+		msg = self.request_message()
+		set_element = getattr(msg, "set_element_%s" % \
+			self.request_body_name,
+			None)
+		if not set_element:
+		    raise service_error(service_error.internal,
+			    "Cannot get element setting method for %s" % \
+				    self.request_body_name)
+		set_element(self.pack_soap(msg, self.request_body_name, req))
+		# If a context is given, use it.  Otherwise construct one from
+		# components.  The construction shouldn't call out for
+		# passwords.
+		if context:
+		    if self.log:
+			self.log.debug("Context passed in to call_soap")
+		    ctx = context
+		else:
+		    if self.log:
+			self.log.debug(
+				"Constructing context in call_soap: %s" % \
+					cert_file)
+		    try:
+			ctx = fedd_ssl_context(cert_file, trusted_certs, 
+				password=cert_pwd)
+		    except SSL.SSLError, e:
+			if self.log:
+			    self.log.debug("Certificate error: %s" % e)
+			raise service_error(service_error.server_config,
+				"Certificates misconfigured")
+		loc = self.locator()
+		get_port = getattr(loc, self.port_name, None)
+		if not get_port:
+		    raise service_error(service_error.internal, 
+			    "Cannot get port %s from locator" % self.port_name)
+		port = get_port(url,
+			transport=M2Crypto.httpslib.HTTPSConnection, 
+			transdict={ 'ssl_context' : ctx },
+			tracefile=tf)
+		remote_method = getattr(port, self.service_name, None)
+		if not remote_method:
+		    raise service_error(service_error.internal,
+			    "Cannot get service from SOAP port")
+
 		fail_exc = None
+		if self.log:
+		    self.log.debug("Calling %s (retry %d)" % \
+			    (self.service_name, retries))
 		resp = remote_method(msg)
 		ok = True
