[Mono-dev] [Mono-list] Two questions about .net/mono internals
L.G. Meredith
lgreg.meredith at gmail.com
Thu Aug 3 19:04:49 EDT 2006
Robert,
Another quick follow up. Suppose that my incoming request were not SOAP --
e.g. it was coming from the proprietary format stream, then implementing a
SOAP extension will not do what i want. i know that there must be a way to
get the current call, but the APIs seem a bit disjointed. i have looked at
MethodInfo.GetCurrentMethod <--> returns a MethodInfo -- no information
about the call
i have looked at StackTrace and StackFrame, but cannot see a way to get the
call information off of these classes easily.
With a ContextBoundObject i can get hold of an instance implementing
IMethodCallMessage <--> does have the call information
But, in the latter case, ContextBoundObject must be in the inheritance
chain. Unfortunately, in this case, c# does not allow multiple inheritance;
so, an object cannot both be a Service (e.g. WebService) and a
ContextBoundObject. In fact WebService and ContextBoundObject are at odds
about marshaling policy. In short, the ContextBoundObject approach is not
compositional -- it doesn't compose with other functionality.
But, i feel there must be some way to get at the IMethodCallMessage critter.
Best wishes,
--greg
On 8/3/06, L.G. Meredith <lgreg.meredith at gmail.com> wrote:
>
> Robert,
>
> Many thanks. i found the SOAP extension stuff just a few hours before your
> reply. As for the point about the formatter, i have implemented my own
> formatter. But, the point is the binary formatter already does most of the
> work i need to do except it adds extra information. In my specialized
> formatter i just want to extract the bit i need from what the binary
> formatter has already produced rather than have to write a great deal of
> formatting code that has already been implemented by binary formatter.
>
> Best wishes,
>
> --greg
>
>
> On 8/3/06, Robert Jordan <robertj at gmx.net> wrote:
> >
> > Hey,
> >
> > L.G. Meredith wrote:
> > > i'm in the process of writing a gateway application. It speaks SOAP
> > out of
> > > one side of it's mouth and a proprietary network application protocol
> > out
> > > the other.
> > >
> > > My application would be much more beautiful and easy to maintain if i
> > had
> > > the following two bits of interface to .net/mono capability.
> > >
> > > 1. i want to trampoline incoming webmethods to invocations to send an
> > > appropriately formatted message to a tcp stream connected to my app.
> > That
> > > is, i would like to get the current (web) method and it's arguments. i
> > > would
> > > prefer not to copy the incoming arguments to an invocation but to
> > > generically call an api that will return a data structure providing
> > all the
> > > information associated with the method invocation, including method
> > name
> > > and
> > > actuals (a.k.a. arguments). i can then pass this data structure to my
> > > stream
> > > formatter to format appropriately for the network stream.
> >
> > Implement a SOAP extension:
> >
> >
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconAlteringSOAPMessageUsingSOAPExtensions.asp
> >
> > > 2. i would like to have the format of the .net/mono binary formatter.
> > It
> >
> > I'm not sure why you need it, but here is it:
> >
> >
> > http://svn.myrealbox.com/viewcvs/trunk/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/binary_serialization_format.htm?rev=27351&view=log
> >
> > > does the work i need to do except that it puts some extra stuff into
> > the
> > > stream. Currently, i have a hack in which i drop markers into the
> > stream
> > > and
> > > pull out the bytes between the markers to get the appropriately
> > formatted
> > > bytes for the packet i need to send. Obviously, this is a brittle
> > solution.
> > > If i had the format the binary serializer uses, then i could extract
> > > them in
> > > a better way. Even better, if i had an API that allowed me to extract
> > > naturally distinct pieces, e.g. just member data, excluding class name
> > or
> > > member name data or even size information, then i could have a very
> > robust
> > > and generic application.
> >
> > Such an API doesn't make sense, unless it's intended to be used
> > by non-CLI languages (C/C++...).
> >
> > You should implement a custom formatter, if you need this level of
> > control.
> >
> > If you want to intercept remoting calls, you could insert a
> > custom server channel sink after the formatter sink and you'll
> > be able to access the remoting messages before they get dispatched.
> >
> > Robert
> >
> > _______________________________________________
> > Mono-list maillist - Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
>
>
>
> --
> L.G. Meredith
> Partner
> Biosimilarity LLC
> 505 N 72nd St
> Seattle, WA 98103
>
> +1 206.650.3740
>
--
L.G. Meredith
Partner
Biosimilarity LLC
505 N 72nd St
Seattle, WA 98103
+1 206.650.3740
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060803/abc2bd5c/attachment.html
More information about the Mono-devel-list
mailing list