By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,364 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,364 IT Pros & Developers. It's quick & easy.

Converting objects thru Web Services or Disconnected

P: n/a
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my data
objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and placed
this on the local machine and the webserver.

When I get my Object A back from the webserver, Visual Studio tells me that
it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same
objects?

I appreciate your help, please let me know if the above makes no sense.

JW
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my data
objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and placed
this on the local machine and the webserver.

When I get my Object A back from the webserver, Visual Studio tells me that
it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same
objects?

I appreciate your help, please let me know if the above makes no sense.

JW
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You will need to cast the datatype explicitly, even though you know it's the
same type. It seems redundant, but if you think about it, there's only one
workaround, which is to have both the Web service and the client reference
the same type definition assembly. To do this, you would (ideally) generate
an XSD file for the custom type, then use xsd.exe to generate the code
definition of the type. You would then compile this definition into an
assembly, that you could reference from clients, services, whoever needed
access to the exact same type definition.

Of course, this approach is not practical in most cases, and it creates a
level of tight coupling that goes against SOA tenets. So you pretty much
have no choice but to treat the Web Service version and the local version as
two separate data types that can cast to eachother. I would still generate
an XSD definition, because this abstracts the definition away from any one
implementation.

Jeffrey Hasan, MCSD
President, Bluestone Partners, Inc.
-----------------------------------------------
Author of: Expert SOA in C# Using WSE 2.0 (APress, 2004)
http://www.bluestonepartners.com/soa.aspx

"John Wilson" <JW@nospam.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my data objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and placed this on the local machine and the webserver.

When I get my Object A back from the webserver, Visual Studio tells me that it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same
objects?

I appreciate your help, please let me know if the above makes no sense.

JW
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my data objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and placed this on the local machine and the webserver.

When I get my Object A back from the webserver, Visual Studio tells me that it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same
objects?

I appreciate your help, please let me know if the above makes no sense.

JW

Nov 21 '05 #2

P: n/a
DC
also, maybe this article will help
http://msdn.microsoft.com/library/en...ce07162002.asp

-D

"Jeffrey Hasan" <an*******@noemail.com> wrote in message
news:uR**************@TK2MSFTNGP10.phx.gbl...
You will need to cast the datatype explicitly, even though you know it's the same type. It seems redundant, but if you think about it, there's only one
workaround, which is to have both the Web service and the client reference
the same type definition assembly. To do this, you would (ideally) generate an XSD file for the custom type, then use xsd.exe to generate the code
definition of the type. You would then compile this definition into an
assembly, that you could reference from clients, services, whoever needed
access to the exact same type definition.

Of course, this approach is not practical in most cases, and it creates a
level of tight coupling that goes against SOA tenets. So you pretty much
have no choice but to treat the Web Service version and the local version as two separate data types that can cast to eachother. I would still generate
an XSD definition, because this abstracts the definition away from any one
implementation.

Jeffrey Hasan, MCSD
President, Bluestone Partners, Inc.
-----------------------------------------------
Author of: Expert SOA in C# Using WSE 2.0 (APress, 2004)
http://www.bluestonepartners.com/soa.aspx

"John Wilson" <JW@nospam.com> wrote in message
news:e2**************@TK2MSFTNGP09.phx.gbl...
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my

data
objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and

placed
this on the local machine and the webserver.

When I get my Object A back from the webserver, Visual Studio tells me

that
it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same objects?

I appreciate your help, please let me know if the above makes no sense.

JW
I have an application that can access data both locally and through web
services (it may be working in a disconnected mode). I have defined my

data
objects (e.g. ObjectA) in a separate component (e.g. DataDefiner) and

placed
this on the local machine and the webserver.

When I get my Object A back from the webserver, Visual Studio tells me

that
it cannot convert WebService.ObjectA to DataDefiner.ObjectA. How can I
define objects that can be read locally or via webservices, using the same objects?

I appreciate your help, please let me know if the above makes no sense.

JW


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.