C# Web Services problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • longroad

    C# Web Services problem

    I need to create a web service with c# and asp.net

    Im a little confused exactly how i should code this, whether i should
    use a class file or if that would be unneccesary.

    Its a web service that will calculate shipping costs for various states.
    the 2 input parameters are state and weight (weight of the parcel).
    I then need to return the shipping cost for the particular state in $.
    Different states have different shipping costs, eg NSW and ACT is $12/kg
    and theres 2 other rates for other states.

    How would I go about firstly coding the web service, then the C# code in
    the asp.net application?
    The application will have a drop down list or radio buttons of various
    states, which the user will pick one of. They will then enter the weight
    into a textbox, click submit, and the weight should be calculated
    corresponding to the state they entered.

    I think this should be quite simple, however my C# skills aren't the
    best, so I really do need some help.

    Thanks in advance.
  • Lebesgue

    #2
    Re: C# Web Services problem

    This is were you should start, explains the whole topic very well:


    And you may find other useful information here as well:



    "longroad" <_sonicrc98_@ho tmail.com> wrote in message
    news:4298364d$0 $4655$afc38c87@ news.optusnet.c om.au...[color=blue]
    > I need to create a web service with c# and asp.net
    >
    > Im a little confused exactly how i should code this, whether i should
    > use a class file or if that would be unneccesary.
    >
    > Its a web service that will calculate shipping costs for various states.
    > the 2 input parameters are state and weight (weight of the parcel).
    > I then need to return the shipping cost for the particular state in $.
    > Different states have different shipping costs, eg NSW and ACT is $12/kg
    > and theres 2 other rates for other states.
    >
    > How would I go about firstly coding the web service, then the C# code in
    > the asp.net application?
    > The application will have a drop down list or radio buttons of various
    > states, which the user will pick one of. They will then enter the weight
    > into a textbox, click submit, and the weight should be calculated
    > corresponding to the state they entered.
    >
    > I think this should be quite simple, however my C# skills aren't the
    > best, so I really do need some help.
    >
    > Thanks in advance.[/color]


    Comment

    • John Timney \(ASP.NET MVP\)

      #3
      Re: C# Web Services problem

      you should always code a web service irrelevent of the interface that will
      access it - so start by finding some simple examples of web services in C#,
      and get some method calls working. You can store your shipping rates in the
      web.config file, or load them from a file (or db), and look them up at each
      request to begin with concluding by loading into
      HttpContext.Cur rent.Cache - or even hard code them if you need to do that.
      the trick is to get your method call working using the default web service
      interface before you ever consider creating a gui front end to actually
      deliver the call.

      As to working out the cost - you perhaps need some kind of hashtable to
      store state and distance from shipping point, and calculate the weight per
      mile for example, or perhaps base it on simple city zones - zone 3 for 25 K
      is X. Shippings actually quite a complicated issue.

      --
      Regards

      John Timney
      ASP.NET MVP
      Microsoft Regional Director

      "longroad" <_sonicrc98_@ho tmail.com> wrote in message
      news:4298364d$0 $4655$afc38c87@ news.optusnet.c om.au...[color=blue]
      >I need to create a web service with c# and asp.net
      >
      > Im a little confused exactly how i should code this, whether i should use
      > a class file or if that would be unneccesary.
      >
      > Its a web service that will calculate shipping costs for various states.
      > the 2 input parameters are state and weight (weight of the parcel).
      > I then need to return the shipping cost for the particular state in $.
      > Different states have different shipping costs, eg NSW and ACT is $12/kg
      > and theres 2 other rates for other states.
      >
      > How would I go about firstly coding the web service, then the C# code in
      > the asp.net application?
      > The application will have a drop down list or radio buttons of various
      > states, which the user will pick one of. They will then enter the weight
      > into a textbox, click submit, and the weight should be calculated
      > corresponding to the state they entered.
      >
      > I think this should be quite simple, however my C# skills aren't the best,
      > so I really do need some help.
      >
      > Thanks in advance.[/color]


      Comment

      Working...