473,500 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Return data structure defined in Class library from WCF Web Service

Hi everyone,

I'm writing a silverlight 2.0 application that uses a web service. The web
service is a WCF web service and it uses a class library that I have
written. When I add a method to the webservice that uses/returns an object
that was defined in the class library all hell breaks loose.
What happens is that my service object no longer has the client class
anymore, all it shows are the objects that are being used from the class
library.

Not sure if I'm explaining it correctly since I'm not very .Net savvy.

Basically when I used to type the service name followed by . it would get
the list which included the service client that I would use to communicate
with the service, now there is no such thing instead it only lists the 3 or
4 classes that the service returns that were defined in the class library.

Am I doing something wrong here? Or do I have to define everything that is
going to be returned in the service.

AliR.
Nov 4 '08 #1
4 7346
Ideally, yes: your WCF layer would define all the types used in that
API via data-contracts ([DataContract]) or similar.

For full-.NET to full-.NET, one option is assembly sharing (i.e.
cheating by placing the service contract and entities in a dll that
both client and server consume), and use that dll at both ends - but
the problem is that it doesn't work if the client/server are different
architectures. And Silverlight qualifies as "different". So yes, I'd
make sure that all the objects you use in the WCF stack are properly
defined as data-contracts, and let "mex" do the rest.

Marc
Nov 4 '08 #2
Hi Marc,

Thanks for the explanation.

Here is another problem

If I define a class ([DataContract]) in the service that returns a list of
bitmaps it does the same thing.
public List<Bitmapimages;

Is there a way to get around this problem?

AliR.

"Marc Gravell" <ma**********@gmail.comwrote in message
news:bf**********************************@d36g2000 prf.googlegroups.com...
Ideally, yes: your WCF layer would define all the types used in that
API via data-contracts ([DataContract]) or similar.

For full-.NET to full-.NET, one option is assembly sharing (i.e.
cheating by placing the service contract and entities in a dll that
both client and server consume), and use that dll at both ends - but
the problem is that it doesn't work if the client/server are different
architectures. And Silverlight qualifies as "different". So yes, I'd
make sure that all the objects you use in the WCF stack are properly
defined as data-contracts, and let "mex" do the rest.

Marc

Nov 4 '08 #3
I ran into this:
http://msdn.microsoft.com/en-us/library/cc681221.aspx

I guess I can do it this way, but it seems painful. I don't understand why
I can't just return a Bitmap object?

AliR.
"AliR (VC++ MVP)" <Al**@online.nospamwrote in message
news:It****************@nlpi070.nbdc.sbc.com...
Hi Marc,

Thanks for the explanation.

Here is another problem

If I define a class ([DataContract]) in the service that returns a list of
bitmaps it does the same thing.
public List<Bitmapimages;

Is there a way to get around this problem?

AliR.

"Marc Gravell" <ma**********@gmail.comwrote in message
news:bf**********************************@d36g2000 prf.googlegroups.com...
>Ideally, yes: your WCF layer would define all the types used in that
API via data-contracts ([DataContract]) or similar.

For full-.NET to full-.NET, one option is assembly sharing (i.e.
cheating by placing the service contract and entities in a dll that
both client and server consume), and use that dll at both ends - but
the problem is that it doesn't work if the client/server are different
architectures. And Silverlight qualifies as "different". So yes, I'd
make sure that all the objects you use in the WCF stack are properly
defined as data-contracts, and let "mex" do the rest.

Marc


Nov 4 '08 #4
In short - serialization. WCF (especially when used from Silverlight)
essentially uses xml serialization. What does a bitmap look like in
xml? There are, however, known ways of serializing raw bytes - hence a
byte[] or Stream will be fine. The Bitmap approach *might* have worked
(maybe, at a push) using NetDataContractSerializer and assembly-
sharing. Neither is an option for Silverlight, so you can rule that
out.

Marc
Nov 5 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

66
4896
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
11
1914
by: Tom Leylan | last post by:
(I posted this in languages.vb also... I can't figure out where things go if you use a little of a lot of things) Hi all... I'm looking for an example (or a pointer to one) related to the...
9
4615
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
12
4100
by: Jose Fernandez | last post by:
Hello. I'm building a web service and I get this error. NEWS.News.CoverNews(string)': not all code paths return a value This is the WebMethod public SqlDataReader CoverNews(string Sport)...
3
2312
by: AtariPete | last post by:
Hey all, I want to return an xml structure without .net trying to inject any of its xml schema? Can this be done? Here is the scenario: I'm running into an issue with the return string of my...
6
1432
by: Jensen Bredhal | last post by:
My returns some obscure class which is somehow very complicated and follow an xml schema. I know by definition that web services send xml packed inside soap packets. Is there a way i can capture...
1
2100
by: Rob Andrew | last post by:
Hi All, I'm new to VS.net, coming from Delphi, and there is something that I'm trying to clarify in my head about VS.net. Suppose you had a class Employee (Name, Age, Title, etc). Lets...
2
3651
ADezii
by: ADezii | last post by:
The incentive for this Tip was an Article by the amazing Allen Browne - I considered it noteworthy enough to post as The Tip of the Week in this Access Forum. Original Article by Allen Browne ...
3
1579
by: Christopher | last post by:
Is it possible to dynamically create a data structure? Not that it matters, but just for understanding, I am working with video shaders, these shaders use thier own language (HLSL) which you...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7018
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.