You must Sign In to post a response.
  • Category: WCF

    Consume webservice from web application

    [DesignerCategory("code")]
    [WebServiceBinding(Name = "BasicHttpBinding_IPremimumCalculatorService", Namespace = "http://tempuri.org/")]
    [GeneratedCode("System.Web.Services", "4.0.30319.17929")]
    [DebuggerStepThrough]
    public class PremiumCalculatorService : SoapHttpClientProtocol
    {
    public PremiumCalculatorService();

    public event ComputePremiumCompletedEventHandler ComputePremiumCompleted;

    public IAsyncResult BeginComputePremium(PremiumCalculatorRequest premiumCalculatorRequest, AsyncCallback callback, object asyncState);
    public void CancelAsync(object userState);
    [SoapDocumentMethod("http://www.apollomunichinsurance.com/B2BService/IPremimumCalculatorService/ComputePremium", RequestNamespace = "http://www.apollomunichinsurance.com/B2BService", ResponseNamespace = "http://www.apollomunichinsurance.com/B2BService", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
    public Client[] ComputePremium(PremiumCalculatorRequest premiumCalculatorRequest);
    public void ComputePremiumAsync(PremiumCalculatorRequest premiumCalculatorRequest);
    public void ComputePremiumAsync(PremiumCalculatorRequest premiumCalculatorRequest, object userState);
    public Client[] EndComputePremium(IAsyncResult asyncResult);
    }


    public class Client
    {
    public Client();

    [XmlArray(IsNullable = true)]
    public Address[] Address { get; set; }
    public int Age { get; set; }
    [XmlIgnore]
    public bool AgeSpecified { get; set; }
    public decimal AnnualIncome { get; set; }
    [XmlIgnore]
    public bool AnnualIncomeSpecified { get; set; }
    public DateTime BirthDate { get; set; }
    [XmlIgnore]
    public bool BirthDateSpecified { get; set; }
    [XmlElement(IsNullable = true)]
    public string ClientCode { get; set; }
    [XmlElement(IsNullable = true)]
    public ContactInformation ContactInformation { get; set; }
    [XmlArray(IsNullable = true)]
    public Client[] Dependants { get; set; }
    public int FamilySize { get; set; }
    [XmlIgnore]
    public bool FamilySizeSpecified { get; set; }
    [XmlElement(IsNullable = true)]
    public string FirstName { get; set; }
    public int GenderCode { get; set; }
    [XmlIgnore]
    public bool GenderCodeSpecified { get; set; }
    public double Height { get; set; }
    [XmlIgnore]
    public bool HeightSpecified { get; set; }
    [XmlElement(IsNullable = true)]
    public string IDProofNumber { get; set; }
    [XmlElement(IsNullable = true)]
    public string IDProofTypeCode { get; set; }
    [XmlElement(IsNullable = true)]
    public string LastName { get; set; }
    public int MaritalStatusCode { get; set; }
    [XmlIgnore]
    public bool MaritalStatusCodeSpecified { get; set; }
    [XmlElement(IsNullable = true)]
    public string MiddleName { get; set; }
    [XmlElement(IsNullable = true)]
    public string NationalityCode { get; set; }
    [XmlElement(IsNullable = true)]
    public string OccuptionCode { get; set; }
    [XmlArray(IsNullable = true)]
    public PreviousInsurer[] PreviousInsurer { get; set; }
    [XmlArray(IsNullable = true)]
    public Product[] Product { get; set; }
    [XmlElement(IsNullable = true)]
    public string ProfessionCode { get; set; }
    public int RelationshipCode { get; set; }
    [XmlIgnore]
    public bool RelationshipCodeSpecified { get; set; }
    public bool SmokerFlag { get; set; }
    [XmlIgnore]
    public bool SmokerFlagSpecified { get; set; }
    [XmlElement(IsNullable = true)]
    public string TitleCode { get; set; }
    public decimal TotalPremium { get; set; }
    [XmlIgnore]
    public bool TotalPremiumSpecified { get; set; }
    public double Weight { get; set; }
    [XmlIgnore]
    public bool WeightSpecified { get; set; }
    }

    I want to call ComputePremium method from my application how to do the same
  • #754839
    Do you added the web reference of the WCF service in the application.

    Add the Web reference.

    Add the respective name space in the class

    Create a object of the service class

    call the method.

    Make sure that the URL of the wcf is correct and you have the respective class reference added.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #754860
    Hi,

    At first u add the Web References to the application after creating the web service.

    2: add name space to the class, craete the object of the service class, then access the method wat ever u created in web servise.

    3: then disply in to the Ui ..


    Thanks,
    chitaranjan


  • Sign In to post your comments