public System.Threading.Tasks.Task <pay.setPayIdResponse> setPayIdAsync(string _posCode, string _billId, string _payId) { pay.setPayIdRequest inValue = new pay.setPayIdRequest(); inValue.Body = new pay.setPayIdRequestBody(); inValue.Body._posCode = _posCode; inValue.Body._billId = _billId; inValue.Body._payId = _payId; return(((pay.PayTJSoap)(this)).setPayIdAsync(inValue)); }
/// <summary> /// 设置付款单号 /// </summary> /// <param name="posCode"></param> /// <returns></returns> public static String SetPayId(string posCode, string billId, string payId) { string result = ""; // 创建 HTTP 绑定对象 var binding = new BasicHttpBinding(); // 根据 WebService 的 URL 构建终端点对象 var endpoint = new EndpointAddress(System.Environment.GetEnvironmentVariable("PayUrl")); // 创建调用接口的工厂,注意这里泛型只能传入接口 添加服务引用时生成的 webservice的接口 一般是 (XXXSoap) var factory = new ChannelFactory <pay.PayTJSoap>(binding, endpoint); // 从工厂获取具体的调用实例 var callClient = factory.CreateChannel(); //调用的对应webservice 服务类的函数生成对应的请求类Body (一般是webservice 中对应的方法+RequestBody 如GetInfoListRequestBody) pay.setPayIdRequestBody body = new pay.setPayIdRequestBody(); //以下是为该请求body添加对应的参数(就是调用webService中对应的方法的参数) body._posCode = posCode; body._billId = billId; body._payId = payId; //获取请求对象 (一般是webservice 中对应的方法+tRequest 如GetInfoListRequest) var request = new pay.setPayIdRequest(body); //发送请求 var v = callClient.setPayIdAsync(request); //异步等待 v.Wait(); //获取数据 result = v.Result.Body.setPayIdResult; return(result); }
System.Threading.Tasks.Task <pay.setPayIdResponse> pay.PayTJSoap.setPayIdAsync(pay.setPayIdRequest request) { return(base.Channel.setPayIdAsync(request)); }