locked
Parameterized Constructor

    Question

  • Why can't we use parameterized constructor in webservice. I know we can define, as it is like any ordinary class. But when from client we try to call paramerterized cosntrutor we only see default constructor with no paramerter (using intellisence). If we can use parameterized constructor then how and if we not then please explain me the reason.

    thanks in advance.

    Wednesday, July 18, 2007 7:33 PM

Answers

  • More than just parameterized constructors - you can't use indexers, properties, events, delegates, generics, etc. You can't use anything that is specific to the .NET platform.

     

    In general, if it can't be described by XML Schema and WSDL, then you can't do it.

    Thursday, July 19, 2007 10:47 PM

All replies

  • That happens because Web Services are just methods (Web Methods) that can be consumed by means of xml messages. They should hide any implementations details to be completely interoperable between different technologies or platforms as well. A class constructor is a concept of the object modeling, and reveals details about the implementation, so ASP.NET just ignore it at the moment to publish the web service contract (WSDL).

     

    Regards,

    Pablo.

     

    Thursday, July 19, 2007 2:30 PM
  • So this means we can't ?
    Thursday, July 19, 2007 2:42 PM
  • Yes, you can't.
    Thursday, July 19, 2007 7:28 PM
  • More than just parameterized constructors - you can't use indexers, properties, events, delegates, generics, etc. You can't use anything that is specific to the .NET platform.

     

    In general, if it can't be described by XML Schema and WSDL, then you can't do it.

    Thursday, July 19, 2007 10:47 PM