2013-04-04 100 views
0

我导入了一个wsdl,并设置了我的Web服务。 这很好,但现在我想要一些我使用的IP地址的灵活性。在端点配置上更改IP地址

这似乎很简单,根据链接 like this

所有我需要做的是设置端点属性是什么,我想:

var client = new SampleClient(); 
client.Endpoint.Address = new EndpointAddress(url); 
client.Open(); 
responseMessage = client.ServiceMethod(requestMessage); 

但在我的具体的例子,我不没有一个可以击中的“端点”属性。 我错过了什么?

PersonSearchWebServiceClient wc = new PersonSearchWebServiceClient(); 
PersonSearchResult r = wc.FindByPersonDetails(ps); 

我WC对象可是没有一个端点财产

+0

你的意思是,你没有看到在PersonSearchWebServiceClient类端点proerty? – Dhawalk 2013-04-04 14:23:52

+0

正确。我只是没有它 – Crudler 2013-04-04 14:38:06

+0

所以我猜测,它的工作原理。正确? – Dhawalk 2013-04-04 14:39:50

回答

0

会有在URL中与导入的服务的Web/App.config中的设置,更新此。

+0

不,我想在运行时执行 – Crudler 2013-04-04 14:05:31

0

从我的项目工作的代码(连接到露天Web服务)

private AuthenticationServiceSoapPortClient getAuthService() 
    { 
     if (_authClient == null || _authClient.State != CommunicationState.Opened) 
     { 
      BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); // For no-Ssl use None 
      basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; 
      basicHttpBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; 
      basicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; 
      basicHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default; 
      var endPoint = new EndpointAddress(_alfrescoURL + "/" + _authEndPointPart); 
      _authClient = new AuthenticationServiceSoapPortClient(basicHttpBinding, endPoint); 
     } 
     return _authClient; 
    } 
+0

这会起作用。但不理想,因为我覆盖了我的配置中的所有basichttpbinding规则 – Crudler 2013-04-05 08:24:38