|
| Re: Web Services returning objects; Cannot serialize in Viewstate/Session due to SOAP headers |
 |
Mon, 31 Mar 2008 15:33:37 +000 |
In my opinion , using the object that is returned from a webservice in your
pages and directly in the code is not a good practice !
because it makes your application a highly coopled with that webservice , and so
make it hard to chagne the service in the future ,
instead , you need a at least an assember class that mapp between the webservice
objects and your custom object ,
so you need to write a cutom obejcts that is used in the application, and let
that assembler class return them instead of returning the actual webservice
object ,
the assembler class must take the webservice object and return a custom object
that you write .....
your cutom object must be marked with Serializable() attribute so that the
runtime can serialize it !
Hope it helps
|
| Post Reply
|
| Re: Web Services returning objects; Cannot serialize in Viewstate/Session due to SOAP headers |
 |
Mon, 31 Mar 2008 15:39:03 +000 |
I understand what you are saying, but the framework we use for our Web Services
has over 100 different Entity classes, each with their own web service. Is there
not another way that would less cumbersome?
|
| Post Reply
|
| Re: Web Services returning objects; Cannot serialize in Viewstate/Session due to SOAP headers |
 |
Mon, 31 Mar 2008 15:53:33 +000 |
ah,
well, I afraid that the only solution is to use Inproc mode !
Please try to check if the generated entities( proxy classes) is partial classes
,
if yes , try to mark them as serializable by writing a new partial class for
every proxy class
e.g: if you have a class called Customer ,
try to write
<Serializable()> _
Partial class Customer ()
End class
this may set the proxy class as serilizable , !
another thing that you need to check is that the original classes (in the
webservice code ) was marked with <Serializable()> attribute !
what is the custom entities type ? are you implementing some remoting
interface(like MarshalByRefObject) that prevent serilizing the classes ?
Update : another solution is to use the cache !
|
| Post Reply
|
| Re: Web Services returning objects; Cannot serialize in Viewstate/Session due to SOAP headers |
 |
Mon, 31 Mar 2008 16:16:22 +000 |
We've now run into the original problem that I've been having. I have been using
the Cache, but for some reason, when I postback on my Gridviews... my Gridview
are grabbing other user's data that is in the Cache. Very odd behavior
considering I am using the key as the SessionID from the StateServer. Data seems
to be overlapping, etc.
|
| Post Reply
|
| Re: Web Services returning objects; Cannot serialize in Viewstate/Session due to SOAP headers |
 |
Mon, 31 Mar 2008 16:49:39 +000 |
Hi
yes, if the data is unique for every user, you need to use a unique cache key
for every user,
e.g: you can concat the userID with some key , this way you can avoid the
overlapping issues
dim key as string= UserID +":" + "SomeKey"
cache(key )= your object
Regards,
|
| Post Reply
|
|
|
|
|
|
|
|
|
|