1.soapUI 中测试接口 http://ws.51book.com:8000/ltips/services/getAvailableFlightWithPriceAndCommisionService1.0?wsdl 可以正常访问 并返回结果集。
在VS2008 中 添加 Web应用 实例接口 调用方法 却得不到返回结果。
代码如下:
com.w_51book.ws.GetAvailableFlightWithPriceAndCommisionServiceImpl_1_0Service ws = new com.w_51book.ws.GetAvailableFlightWithPriceAndCommisionServiceImpl_1_0Service(); MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); availableFlightWithPriceAndCommisionRequest model = new availableFlightWithPriceAndCommisionRequest(); model.agencyCode = "KISS"; //公司代码 model.orgAirportCode = "PEK"; //起飞城市 model.dstAirportCode = "CGO"; //抵达城市 model.date = "2012-05-19"; model.onlyAvailableSeat = 0; model.onlyNormalCommision = 0; model.onlyOnWorkingCommision = 1; model.onlySelfPNR = 0; string sign = model.agencyCode + model.dstAirportCode + model.onlyAvailableSeat + model.onlyNormalCommision + model.onlyOnWorkingCommision + model.onlySelfPNR + model.orgAirportCode + "sdidkd"; model.sign = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(sign))).Replace("-", "").ToLower(); availableFlightWithPriceAndCommisionReply result = ws.getAvailableFlightWithPriceAndCommision(model); if (result != null && result.flightItems != null) { this.TextBox1.Text = result.flightItems.Count().ToString(); } else { this.TextBox1.Text = "纠结的一天"; }
现在 求解 大牛 到底咋回事啊!
调用的接口是用java写的。
不知道你的错误在哪里,我写了个简单的控制台应用,生成的服务名称空间是ServiceReference1,代码如下:
static void Main(string[] args) { ServiceReference1.GetAvailableFlightWithPriceAndCommisionService_1_0Client client = new ServiceReference1.GetAvailableFlightWithPriceAndCommisionService_1_0Client(); MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); availableFlightWithPriceAndCommisionRequest model = new availableFlightWithPriceAndCommisionRequest(); model.agencyCode = "KISS"; //公司代码 model.orgAirportCode = "PEK"; //起飞城市 model.dstAirportCode = "CGO"; //抵达城市 model.date = "2012-05-19"; model.onlyAvailableSeat = 0; model.onlyNormalCommision = 0; model.onlyOnWorkingCommision = 1; model.onlySelfPNR = 0; string sign = model.agencyCode + model.dstAirportCode + model.onlyAvailableSeat + model.onlyNormalCommision + model.onlyOnWorkingCommision + model.onlySelfPNR + model.orgAirportCode + "sdidkd"; model.sign = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(sign))).Replace("-", "").ToLower(); availableFlightWithPriceAndCommisionReply result = client.getAvailableFlightWithPriceAndCommision(model); string msg; if (result != null && result.flightItems != null) { Debug.WriteLine("OK"); Debug.WriteLine(msg = result.flightItems.Count().ToString()); } else { Debug.WriteLine("ERROR"); Debug.WriteLine(msg = "纠结的一天"); } MessageBox.Show(msg); }
运行结果是:
result:不为空
result.flightItems:为空
消息显示:纠结的一天