Esempio n. 1
0
        public WitsmlClient(string hostname, string username, string password, bool logQueries = false)
        {
            if (string.IsNullOrEmpty(hostname))
            {
                throw new ArgumentNullException(nameof(hostname), "Hostname is required");
            }
            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentNullException(nameof(username), "Username is required");
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException(nameof(password), "Password is required");
            }

            var serviceBinding  = CreateBinding();
            var endpointAddress = new EndpointAddress(hostname);

            client = new StoreSoapPortClient(serviceBinding, endpointAddress);
            client.ClientCredentials.UserName.UserName = username;
            client.ClientCredentials.UserName.Password = password;
            serverUrl = new Uri(hostname);

            client.Endpoint.EndpointBehaviors.Add(new EndpointBehavior());
            SetupQueryLogging(logQueries);
        }
Esempio n. 2
0
 private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress()
 {
     return(StoreSoapPortClient.GetEndpointAddress(EndpointConfiguration.StoreSoapPort));
 }
Esempio n. 3
0
 private static System.ServiceModel.Channels.Binding GetDefaultBinding()
 {
     return(StoreSoapPortClient.GetBindingForEndpoint(EndpointConfiguration.StoreSoapPort));
 }
Esempio n. 4
0
 public StoreSoapPortClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(StoreSoapPortClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 5
0
 public StoreSoapPortClient(EndpointConfiguration endpointConfiguration) :
     base(StoreSoapPortClient.GetBindingForEndpoint(endpointConfiguration), StoreSoapPortClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
Esempio n. 6
0
 public StoreSoapPortClient() :
     base(StoreSoapPortClient.GetDefaultBinding(), StoreSoapPortClient.GetDefaultEndpointAddress())
 {
     this.Endpoint.Name = EndpointConfiguration.StoreSoapPort.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }