webservice 调用修改

This commit is contained in:
2023-07-13 10:09:46 +08:00
parent 4449a7754f
commit e4b7694e42
22 changed files with 4510 additions and 8373 deletions
+17 -17
View File
@@ -10,24 +10,24 @@
public static class ServiceProxy
{
///// <summary>
///// 创建客户端服务
///// </summary>
//public static HSSEService.HSSEServiceClient CreateServiceClient()
//{
// string address = ConfigurationManager.AppSettings["endpoint"];
// var proxy = new HSSEService.HSSEServiceClient();
// ConfigEndpointAddress<HSSEService.HSSEService>(proxy, address);
// return proxy;
//}
///// <summary>
///// 创建客户端服务
///// </summary>
public static BLL.CNCECHSSEService.HSSEServiceClient CreateServiceClient()
{
string address = ConfigurationManager.AppSettings["endpoint"];
var proxy = new BLL.CNCECHSSEService.HSSEServiceClient();
ConfigEndpointAddress<BLL.CNCECHSSEService.HSSEService>(proxy, address);
return proxy;
}
/// <summary>
/// 根据web.config中服务器端主机地址配置服务通道的终端地址。
/// </summary>
/// <typeparam name="TChannel">通道类型</typeparam>
/// <param name="proxy">代理</param>
/// <param name="endpointAddress">服务访问地址</param>
public static void ConfigEndpointAddress<TChannel>(System.ServiceModel.ClientBase<TChannel> proxy, string endpointAddress)
/// <summary>
/// 根据web.config中服务器端主机地址配置服务通道的终端地址。
/// </summary>
/// <typeparam name="TChannel">通道类型</typeparam>
/// <param name="proxy">代理</param>
/// <param name="endpointAddress">服务访问地址</param>
public static void ConfigEndpointAddress<TChannel>(System.ServiceModel.ClientBase<TChannel> proxy, string endpointAddress)
where TChannel : class
{
Uri endpointUri = new Uri(endpointAddress);