473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Web Services & Custom Classes

I posted a similar question last week and got an answer but its not working.

I have three projects in a solution. Project A is a library. Project B is a
web service. Project C is a windows app.

Project B and C make reference to project A in order to share the same
library of classes. There is an abstract class in A and class that derives
from the abstract one.

Project B references project A and has a web method who's return type is the
class in project A that derives from an abstract class.

When Project C calls the web method in project B nothing comes back. This
should not be the case and I have verified via debug that the object is
instantiated, populated with values, but when the return statement is
executed the caller gets a null object back.

I also started the solution in debug with Project A (web service) as the
start up app. I invoked the web method and recieved xml output that has no
child nodes...in other words NOTHING but just before that the object to be
returned again was instantiated and had values.

I have tried using XmlInclude in various locations to no avail. Im not quite
sure how to get this thing working.

Someone showed me the following, that does not do exactly what I'm doing.
Instead the example has everythign within the web service itself. This is not
how my classes are encapsulated. Mine are split out as I described
above....shared library.

http://msdn.microsoft.com/library/de...classtopic.asp

Can anyone help me out here? I'm getting a bit desparate as the deadline
approaches. Thanks!
--
-Demetri
Nov 16 '05 #1
4 1961
Demetri,

The problem here is that when you expose the class from library A
through the web service, a WSDL file is created which defines that type
which is exposed. On the other end, when you create the proxy, it creates a
new type definition which is compatable with the old one, but is not the
same. This is the reason for the null return value.

What you need to do is go into the proxy, and change the code so that it
will instantiate the type from library A and not the type that it defines
from the WSDL. Then, it should work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
I posted a similar question last week and got an answer but its not
working.

I have three projects in a solution. Project A is a library. Project B is
a
web service. Project C is a windows app.

Project B and C make reference to project A in order to share the same
library of classes. There is an abstract class in A and class that derives
from the abstract one.

Project B references project A and has a web method who's return type is
the
class in project A that derives from an abstract class.

When Project C calls the web method in project B nothing comes back. This
should not be the case and I have verified via debug that the object is
instantiated, populated with values, but when the return statement is
executed the caller gets a null object back.

I also started the solution in debug with Project A (web service) as the
start up app. I invoked the web method and recieved xml output that has no
child nodes...in other words NOTHING but just before that the object to be
returned again was instantiated and had values.

I have tried using XmlInclude in various locations to no avail. Im not
quite
sure how to get this thing working.

Someone showed me the following, that does not do exactly what I'm doing.
Instead the example has everythign within the web service itself. This is
not
how my classes are encapsulated. Mine are split out as I described
above....shared library.

http://msdn.microsoft.com/library/de...classtopic.asp

Can anyone help me out here? I'm getting a bit desparate as the deadline
approaches. Thanks!
--
-Demetri

Nov 16 '05 #2
I've already done this and that did solve the problem of being able to share
class types over multiple projects. This can't be the issue i'm having at
this point though. The reason is because like I said.....I've executed the
web service itself and same problem. Therefore, no proxy is involved.

-Demetri

"Nicholas Paldino [.NET/C# MVP]" wrote:
Demetri,

The problem here is that when you expose the class from library A
through the web service, a WSDL file is created which defines that type
which is exposed. On the other end, when you create the proxy, it creates a
new type definition which is compatable with the old one, but is not the
same. This is the reason for the null return value.

What you need to do is go into the proxy, and change the code so that it
will instantiate the type from library A and not the type that it defines
from the WSDL. Then, it should work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
I posted a similar question last week and got an answer but its not
working.

I have three projects in a solution. Project A is a library. Project B is
a
web service. Project C is a windows app.

Project B and C make reference to project A in order to share the same
library of classes. There is an abstract class in A and class that derives
from the abstract one.

Project B references project A and has a web method who's return type is
the
class in project A that derives from an abstract class.

When Project C calls the web method in project B nothing comes back. This
should not be the case and I have verified via debug that the object is
instantiated, populated with values, but when the return statement is
executed the caller gets a null object back.

I also started the solution in debug with Project A (web service) as the
start up app. I invoked the web method and recieved xml output that has no
child nodes...in other words NOTHING but just before that the object to be
returned again was instantiated and had values.

I have tried using XmlInclude in various locations to no avail. Im not
quite
sure how to get this thing working.

Someone showed me the following, that does not do exactly what I'm doing.
Instead the example has everythign within the web service itself. This is
not
how my classes are encapsulated. Mine are split out as I described
above....shared library.

http://msdn.microsoft.com/library/de...classtopic.asp

Can anyone help me out here? I'm getting a bit desparate as the deadline
approaches. Thanks!
--
-Demetri


Nov 16 '05 #3
Demetri,

Can you boil your code down into a small sample (even if it is across
multiple projects).
"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
I've already done this and that did solve the problem of being able to
share
class types over multiple projects. This can't be the issue i'm having at
this point though. The reason is because like I said.....I've executed the
web service itself and same problem. Therefore, no proxy is involved.

-Demetri

"Nicholas Paldino [.NET/C# MVP]" wrote:
Demetri,

The problem here is that when you expose the class from library A
through the web service, a WSDL file is created which defines that type
which is exposed. On the other end, when you create the proxy, it
creates a
new type definition which is compatable with the old one, but is not the
same. This is the reason for the null return value.

What you need to do is go into the proxy, and change the code so that
it
will instantiate the type from library A and not the type that it defines
from the WSDL. Then, it should work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
>I posted a similar question last week and got an answer but its not
>working.
>
> I have three projects in a solution. Project A is a library. Project B
> is
> a
> web service. Project C is a windows app.
>
> Project B and C make reference to project A in order to share the same
> library of classes. There is an abstract class in A and class that
> derives
> from the abstract one.
>
> Project B references project A and has a web method who's return type
> is
> the
> class in project A that derives from an abstract class.
>
> When Project C calls the web method in project B nothing comes back.
> This
> should not be the case and I have verified via debug that the object is
> instantiated, populated with values, but when the return statement is
> executed the caller gets a null object back.
>
> I also started the solution in debug with Project A (web service) as
> the
> start up app. I invoked the web method and recieved xml output that has
> no
> child nodes...in other words NOTHING but just before that the object to
> be
> returned again was instantiated and had values.
>
> I have tried using XmlInclude in various locations to no avail. Im not
> quite
> sure how to get this thing working.
>
> Someone showed me the following, that does not do exactly what I'm
> doing.
> Instead the example has everythign within the web service itself. This
> is
> not
> how my classes are encapsulated. Mine are split out as I described
> above....shared library.
>
> http://msdn.microsoft.com/library/de...classtopic.asp
>
> Can anyone help me out here? I'm getting a bit desparate as the
> deadline
> approaches. Thanks!
> --
> -Demetri


Nov 16 '05 #4
Actually, I have figured it out. It would seem that only PUBLIC properties
that have BOTH a get and set accessor will be included in the serialization.
I only had the GET accessor. This leads to my next question: Is there a way
around this?

-Demetri

"Nicholas Paldino [.NET/C# MVP]" wrote:
Demetri,

Can you boil your code down into a small sample (even if it is across
multiple projects).
"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:39**********************************@microsof t.com...
I've already done this and that did solve the problem of being able to
share
class types over multiple projects. This can't be the issue i'm having at
this point though. The reason is because like I said.....I've executed the
web service itself and same problem. Therefore, no proxy is involved.

-Demetri

"Nicholas Paldino [.NET/C# MVP]" wrote:
Demetri,

The problem here is that when you expose the class from library A
through the web service, a WSDL file is created which defines that type
which is exposed. On the other end, when you create the proxy, it
creates a
new type definition which is compatable with the old one, but is not the
same. This is the reason for the null return value.

What you need to do is go into the proxy, and change the code so that
it
will instantiate the type from library A and not the type that it defines
from the WSDL. Then, it should work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Demetri" <De*****@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
>I posted a similar question last week and got an answer but its not
>working.
>
> I have three projects in a solution. Project A is a library. Project B
> is
> a
> web service. Project C is a windows app.
>
> Project B and C make reference to project A in order to share the same
> library of classes. There is an abstract class in A and class that
> derives
> from the abstract one.
>
> Project B references project A and has a web method who's return type
> is
> the
> class in project A that derives from an abstract class.
>
> When Project C calls the web method in project B nothing comes back.
> This
> should not be the case and I have verified via debug that the object is
> instantiated, populated with values, but when the return statement is
> executed the caller gets a null object back.
>
> I also started the solution in debug with Project A (web service) as
> the
> start up app. I invoked the web method and recieved xml output that has
> no
> child nodes...in other words NOTHING but just before that the object to
> be
> returned again was instantiated and had values.
>
> I have tried using XmlInclude in various locations to no avail. Im not
> quite
> sure how to get this thing working.
>
> Someone showed me the following, that does not do exactly what I'm
> doing.
> Instead the example has everythign within the web service itself. This
> is
> not
> how my classes are encapsulated. Mine are split out as I described
> above....shared library.
>
> http://msdn.microsoft.com/library/de...classtopic.asp
>
> Can anyone help me out here? I'm getting a bit desparate as the
> deadline
> approaches. Thanks!
> --
> -Demetri


Nov 16 '05 #5

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

Similar topics

1
by: normd | last post by:
I have a text file which contains VB.NET code. The VB.NET code is actually a Class that can contain code, which simply displays a message box or does something more complicated (i.e Excel/Word...
5
by: terry | last post by:
Hi, Question: When using Framesets and Server.Transfer in the Application_Error event handler is there a mechanism to get the error page to display in the total view of the browser not just in...
2
by: John A Grandy | last post by:
for high traffic public websites , what are the proven options for session-state storage & management ? is an out-of-process state-server generally preferred over a sql-server ? what are the...
3
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
6
by: Moshe Kravchik | last post by:
Hi all! I have 2 web services, one writtenin C++ (ATL) and another one in C#. Is there a way to define data stuctures in a single place both services could use? The structures are the same, but if...
4
by: John | last post by:
I have WSDL file with <wsdl:fault> element. When I use Websphere WSAD to generate Java proxy classes from WSDL, I am able to see the custom exception classes that correspond to the <wsdl:fault>...
1
by: Ankur Goenka | last post by:
Hi, I am trying to include two proxy classes (from two different web services say Namespace.Service1 and Namespace.Service2) in a project (C# Class lib). These webservice internally use (as...
4
by: alexandis | last post by:
We have tables of logins (users), that differs much from standard microsoft structure - we don't use control question/answer, date fields, etc. But instead we have several additional fields. I...
0
by: jb489 | last post by:
Hi all, Hope I am posting this in the right forum. I seem to be having a problem when using serialization and web services. <b>Scenario:</b> I have built a web service which includes a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.