Factoring out stuff, making room for SOAP client functionality.