Re: Detecting wich method was called in a WS contructor

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dino Chiesa [Microsoft] (dinoch_at_online.microsoft.com)
Date: 05/17/04


Date: Mon, 17 May 2004 08:46:43 -0400

It's true there is a pending invocation of a webmethod when the constructor
is invoked but this is not explicit in the programming model. In other
words, your constructor does not know what method is being called. The
method may be known agt some lower level in the stack, but this information
is not provided to the constructor at the time it is invoked.

I get the point that you want to know the method that will be invoked before
it is actually invoked.
When I said, "tell us more, maybe we can help solve it in a different way",
what I meant was, why do you need to know the method before it is invoked?
You said you want to init the object differently depending on how it will be
used in the future. This runs a bit counter to the webservices model, which
is, there is a service that exists, and it exposes methods. Callers invoke
methods. callers generally do not get involved in directly managing the
lifecycle of the service.

But if you don't want to do only initialization (you said "special
treatment"), maybe there is another way.
If you want to do logging, for example, there are ways to do this without
adding a great deal of code, and without adding code to each method.

If there is some other purpose, maybe you could explain it and the group can
explore options.

-Dino

"DDE" <dde@aireinfo.com> wrote in message
news:uPZ5j4XOEHA.904@TK2MSFTNGP12.phx.gbl...
> Hi DIno,
>
> Thanks for your answer, I thought at the time the constructor is invoked,
> the method would be known, since at least it is included in the SOAP
> message, right?
> Anyway, my problem is the following: our development team has to write a
lot
> of Web Services, so I created a couple of standard classes in order to
make
> web service code itself as simple and compact as possible. I have build a
> kind of OurWebService class based on SystemWebservice that contains a
> constructor and a couple of properties and method. One of the things I
> couldn't figure out yet is how to make some initialization or treatment
> depending on the WebMethod which is invoked.
>
> Dominique
>
>
> "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in message
> news:OXuJn3OOEHA.540@TK2MSFTNGP11.phx.gbl...
> > You don't know.
> > The constructor is called before any webmethod is called.
> >
> > If you tell us a bit more about the situation maybe we can help you
solve
> it
> > a different way.
> > -Dino
> >
> >
> > "DDE" <dde@aireinfo.com> wrote in message
> > news:OaSRYADOEHA.644@tk2msftngp13.phx.gbl...
> > > Hi everybody,
> > >
> > > I have a WebService with a constructor to initialize some values comon
> to
> > > all my WebMethods. In this constructor, I would like to identify which
> > > WebMethod was invoked. Is it possible and how?
> > >
> > > Thanks a lot
> > >
> > > Dominique
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Dynamic inheritance
    ... >> to invoke the development portion of the IDE to modify the tree and ... > That's not the case in Smalltalk, ... properties at run time when the constructor is invoked. ... repository, modify the tree with the existing IDE tools, and then let ...
    (comp.object)
  • Re: Calling a constructor from another
    ... instantiated is a composite of all the properties in all classes in the direct line of ascent in the subclassing tree, the usual technique is to provide a constructor for each class to handle that class' properties and invoke them in a nested fashion. ... While using the Factory pattern ... the method responsibilities they need to invoke constructors. ...
    (comp.object)
  • Re: Invoke a superclass method from a subclass constructor
    ... An instance of my subclass doesn't invoke its superclass method, ... In B's constructor, you create a new instance of A (a pointless ... use its "super" function as an excersise to the reader. ...
    (comp.lang.python)
  • Re: Detecting wich method was called in a WS contructor
    ... Have you looked at using a SOAP Extension together with a custom attribute ... > each WebMethod, but I would like to be able to remove this from the ... your constructor does not know what method is being called. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: 2 initializers in 1 constructor
    ... the dot not compiler does allow us to invoke 2 constuctors(whether the ... you have to invoke one of the constructor defined by the ... would become unreached oblect. ... When you call a sibling constructor, it calls a base constructor. ...
    (microsoft.public.dotnet.languages.csharp)