Web reference problem on WCF
- by kaivalya
I have a WCF service which I am able to connect to from my web application and get data.
I now added a web reference to this wcf project to a wsdl file that a shipping company provides. Intention is to get shipping quotes..
I am able to access the objects that are generated from this wsdl file but when I call service.Authenticate("DEMO");
method almost nothing happens. I debug and see the debugger continue to the next lines but there is no change on service parameters and service.isauthorized is null..
Can you lead me to how I should debug this further and things I should check, or if there are additional steps that I need to ensure to have a web reference working on wcf app
Thanks
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();
}
}
}