public ServiceContent Connect() { if (string.IsNullOrEmpty(this._serviceUrl)) { throw new InvalidOperationException(Resources.InvalidServiceUrl); } try { this._vimService = this.CreateClientChannel(); ServiceContent content = new ServiceInstance((VimClient)this, new ManagedObjectReference() { Type = "ServiceInstance", Value = "ServiceInstance" }).RetrieveServiceContent(); this._version = VersionUtils.GetVIServerVersion(content); this._serviceContent = content; return(this._serviceContent); } catch (ProtocolException ex) { throw new VimProtocolException(ex.Message, (Exception)ex); } catch (EndpointNotFoundException ex) { throw new VimEndpointNotFoundException(ex.Message, (Exception)ex); } catch (SecurityNegotiationException ex) { throw new VimSecurityNegotiationException(ex.Message, (Exception)ex); } catch (CommunicationException ex) { throw new VimException(ex.Message, (Exception)ex); } }