我有一个WCF服务,我可以从我的Web应用程序连接到并获取数据。WCF上的Web引用问题
我现在添加了一个web引用这个wcf项目到一个航运公司提供的wsdl文件。意图是得到航运报价..
我能够访问从此wsdl文件生成的对象,但是当我调用service.Authenticate(“DEMO”);
方法几乎没有任何反应。我调试并看到调试器继续到下一行但服务参数和服务没有变化。授权为空..
你能带我到我应该如何进一步调试,我应该检查,或者如果还有,我需要确保有一个Web引用工作WCF应用
感谢
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ShippingCalculator.com.freight.api;
namespace ShippingCalculator
{
public class ShippingService : IShippingService
{
freight_service service = new freight_service();
public string GetData(int value)
{
service.setConnectionType(".net");
service.Authenticate("DEMO");
OriginRequest origin = new OriginRequest();
origin.zip = "60101";
DestinationRequest destination = new DestinationRequest();
destination.zip = "10001";
PackageRequest package = new PackageRequest();
package.weight = "10";
ShipmentInfoRequest shipmentInfo = new ShipmentInfoRequest();
shipmentInfo.ship_date = DateTime.Now.AddDays(5);
service.setOrigin(origin);
service.setDestination(destination);
service.setPackage(package);
service.setShipmentInfo(shipmentInfo);
Quote quote = service.getQuote();
return string.Format("Quote Number: {0}<br /> ", quote.QuoteNumber);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShippingTestApp.ShippingServiceReference;
namespace ShippingTestApp.Controllers
{
[HandleError]
public class HomeController : Controller
{
public ActionResult Index()
{
ShippingServiceClient shipClient = new ShippingServiceClient();
shipClient.GetData(0);
ViewData["Message"] = shipClient.GetData(0);
return View();
}
}
}
托运人对象是服务还是服务返回的数据? – 2009-08-27 19:26:31
其服务 – kaivalya 2009-08-27 19:27:34
你能发布你的源代码片段吗? – 2009-08-27 19:29:32