Hi Keith,
These reasons all make sense to me. It is this kind of thinking that is
required to determine what methods are exposed or not. Without an in-depth
understanding of your code, I have been trying to just frame the basics.
Some more things to look for in your design (these would need to be
changed) if you want this migration to work over web services:
1. The web service classes cannot expose fields or properties directly.
These will not make it to the proxy. Any requirement for data must be
fully encapsulated within the contracts as defined by the exposed method
signatures. In this way, the sum of the data types returned or sent to
your methods defines what a remote caller can expect to have access to.
2. The web service caller should not expect the proxy to behave like a
local instantiation of a class. That is, it isn't safe to assume that
because one does a "new" on the proxy, you have an instance of a class on
the server. The service only exposes methods.... that said, if you
absolutely need state, you can get it by enabling session management, but
this requires configuring the proxy to accept cookies, or other data
passing mechanisms that get around the fact that each instance of a method
call works with a new instance of the service class.
These things may be obvious, but if you are coming from an existing set of
objects and simply trying to convert them to web services, these are common
areas where such ports trip up.
If you are writing anew, then these are things to avoid, if you don't
already know them. I do like the added translation to GUID that you've
done - as long as this makes the key an immutable aspect that references
the same data over time. The added layer of indirection lets you do some
interesting things on the back-end, and since you've done this, I'm sure
you appreciate these already.
It sure looks like you're putting the right amount of time into thinking
this through. Good show
Dan
--------------------
>From: "Keith Chadwick" <webmaster-nospam@allianceevents.com>
>References: <OtiWHPI2EHA.1152@TK2MSFTNGP14.phx.gbl>
<UsUTTHK2EHA.768@cpmsftngxa10.phx.gbl>
>Subject: Re: Web Service Concepts Confirmation?
>Date: Thu, 2 Dec 2004 15:24:22 -0500
[quoted text clipped - 8 lines]
>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:27001
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 100 lines]
>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
>> phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 54 lines]
>>>Cheers
>>>Keith
Keith Chadwick - 02 Dec 2004 21:29 GMT
Thanks Dan,
My original web services that returned xml had the actuall db keys and that
frightened my a bit. I have a big sign in my office that says Security
Security Security! Hence going to guid.
As for session and state not to worried. I do a matched pairing of login
guid key with session key. So every request you must submit your login
guid. This is stored in your user account in the db with a expiration time.
If you make a request the system checks to see if you already have a
session, which is xml by the way :-), if you do compares the guid and the
timestamp of the guid. If you need a new one the database provides, if not
away you go. If you do not have a session then the guid is sent straight to
the db in order to create a session under the current request. This is all
automatically done by my director class. Had to do some fiddling for method
of http call, i.e. soap, post etc. Basically I make no assumptions about
the stateless world and trust no one.
As for exposed methods they are all very simple. You call the core web
service to login and get your key. Every call after that you have to submit
your key whether your doing a soap package, form post or simply http
request. I try to build everything in blocks and go easy on db througput
whenever I can. Use the middle tier for its intended purpose I allways say.
As an extra level of security the guids stored in the db are routinely
changed via a scheduled stored procedure to ensure that consumers don't
start hardcoded the calls.
Think I'm covering everything :-)
Thanks for all the feeback. I get the impression I am on the right track
and that is a very good feeling to have!
Cheers
Keith
> Hi Keith,
>
[quoted text clipped - 244 lines]
>>>>Cheers
>>>>Keith
Keith Chadwick - 02 Dec 2004 21:51 GMT
As a side note. None of my web services will have properties only methods
and you allways provide your credentials to get in. The web service methods
provide interfaces into my actual classes. Each class represents an object
in xml from the database and requires credentials as well.
Right about the session though, would be nice to keep the server memory down
by not creating new session when necessary. This will also reduce db calls.
Will do some testing to see if new sessions are being created on XMLHTTP
calls and other methods via tracing the sql server. Memory may be cheap but
it still a resource one need not use frivolously.
Again, thanks for the feedback been great.
Cheers
Keith
> Hi Keith,
>
[quoted text clipped - 244 lines]
>>>>Cheers
>>>>Keith
Dan Rogers - 02 Dec 2004 22:39 GMT
Hi Keith,
Sounds like you're very happy with where you are at.
Glad to help
Dan
--------------------
>From: "Keith Chadwick" <webmaster-nospam@allianceevents.com>
>References: <OtiWHPI2EHA.1152@TK2MSFTNGP14.phx.gbl>
<UsUTTHK2EHA.768@cpmsftngxa10.phx.gbl>
<eL1O#2K2EHA.3336@TK2MSFTNGP11.phx.gbl>
<RZ2I4IL2EHA.4068@cpmsftngxa10.phx.gbl>
>Subject: Re: Web Service Concepts Confirmation?
>Date: Thu, 2 Dec 2004 16:51:41 -0500
[quoted text clipped - 8 lines]
>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:27009
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 71 lines]
>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11
>> phx.gbl
>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 118 lines]
>>>>>NNTP-Posting-Host: ottawa-hs-64-26-156-220.s-ip.magma.ca 64.26.156.220
>>>>>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
>>>> phx.gbl
>>>>>Xref: cpmsftngxa10.phx.gbl
[quoted text clipped - 62 lines]
>>>>>Cheers
>>>>>Keith