Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. web services overloaded methods

web services overloaded methods

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netwcfsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    V 0
    wrote on last edited by
    #1

    Can you use overloaded functions in Web Services? I have to build a web service here at work and to get used to it I wanted to build a simple calculator. (it's my first Web Service, but I have built several ASP.NET apps.) when I use eg. public int Add(int op1, int op2){} there is no problem. If I however would add another function eg. public double Add(double op1, double op2){} My app crashes with a server 500 error. ([WebMethod] attributes are set) Is this normal? tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

    T 1 Reply Last reply
    0
    • V V 0

      Can you use overloaded functions in Web Services? I have to build a web service here at work and to get used to it I wanted to build a simple calculator. (it's my first Web Service, but I have built several ASP.NET apps.) when I use eg. public int Add(int op1, int op2){} there is no problem. If I however would add another function eg. public double Add(double op1, double op2){} My app crashes with a server 500 error. ([WebMethod] attributes are set) Is this normal? tnx! "If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix

      T Offline
      T Offline
      tojamismis
      wrote on last edited by
      #2

      Web services don't really support overloading. You can implement both methods with the same name, but you will need to have different names for the WebMethod. So you could have [WebMethod(MessageName="AddInt")] public int Add(int op1, int op2) {} [WebMethod(MessageName="AddDouble")] public double Add(double op1, double op2){} To the outside world there will be two different methods. That is the closest you can come to overloading with Web Services. (Hopefully someday it will be different.) Torin Blair - MCP
      'In the immortal words of Socrates - "I drank what?".'

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups