473,785 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

web service returned object type problem

Hi all.

I have a webservice and a windows app.
both of them reference the same class library called WebServiceTest. Core
that defines a class called Class1.

the webservice exposes a method that looks like this:

[WebMethod]
public WebServiceTest. Core.Class1 GetClass1()
{
return new WebServiceTest. Core.Class1();
}

the windows app has a web reference to the webservice (and a reference to
the class library).
I want (and even expected) the web-method to return a
WebServiceTest. Core.Class1 object but instead it returns a
WebServicesTest .Client.localho st.Class1 where:
WrbServicesTest .Client is the windows app namespace
localhost is the name of the webreference to the web service
Class1 is some generated class that represents the return type.

my question is simple:

I need the original object. this is why both webservice and windows app
reference the shared assembly...
what can I do?
what am I doing wrong?

thanx,

Picho
Nov 23 '05 #1
6 1912
Web services is always about XML and interoperabilit y, and the way
WSDL.exe 1.1 works is always to created the object from XML schema that
comes with WSDL file(the types). even if you have to web services that
use a same object, but WSDL.exe 2.0 offers /shared schema across the
service.

for now, assuming that you are writing this against 1.1. you'll have to
manually replace all the instance and definition of
"WebServicesTes t.Client.localh ost.Class1" in the web reference with your
WebServiceTest. Core.Class1 .
The other way is to use remoting instead of web services, a it is a
better option i both the client and server side are .Net.

Regards
Erymuzuan Mustapa

Picho wrote:
Hi all.

I have a webservice and a windows app.
both of them reference the same class library called WebServiceTest. Core
that defines a class called Class1.

the webservice exposes a method that looks like this:

[WebMethod]
public WebServiceTest. Core.Class1 GetClass1()
{
return new WebServiceTest. Core.Class1();
}

the windows app has a web reference to the webservice (and a reference to
the class library).
I want (and even expected) the web-method to return a
WebServiceTest. Core.Class1 object but instead it returns a
WebServicesTest .Client.localho st.Class1 where:
WrbServicesTest .Client is the windows app namespace
localhost is the name of the webreference to the web service
Class1 is some generated class that represents the return type.

my question is simple:

I need the original object. this is why both webservice and windows app
reference the shared assembly...
what can I do?
what am I doing wrong?

thanx,

Picho

Nov 23 '05 #2

The same question just came up in
microsoft.publi c.dotnet.framew ork.webservices . As erymuzuan pointed out
..NET 2.0 will fix the issue once and for all, for now your best choice
is to edit the generated files, or even better, write a simple app or a
perl script that strips out all redundant classes generated from the
WSDL. There's an MSDN article that describes the edits you need [0].

The use of remoting is strongly discouraged [1] at this point with
respect to future interoperabilit y issues and a programming model that
tempts developers to develop strongly coupled systems based on the
distributed object metaphor. Personally, I like the .NET Remoting
framework, and I am somewhat disappointed to see such a fine framework
go away, but knowing the issues ahead I can no longer recommend building
new distributed systems on .NET Remoting. At this point .NET Remoting
should strictly be used for intra-process/cross app domain scenarios.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

[0]
http://msdn.microsoft.com/library/en...vice07162002.a
sp

[1] http://weblogs.asp.net/cschittko/arc...27/143388.aspx
-----Original Message-----
From: Picho [mailto:SP****** **@telhai.ac.il]
Posted At: Sunday, January 02, 2005 12:31 PM
Posted To: microsoft.publi c.dotnet.framew ork.webservices
Conversation: web service returned object type problem
Subject: web service returned object type problem

Hi all.

I have a webservice and a windows app.
both of them reference the same class library called WebServiceTest. Core that defines a class called Class1.

the webservice exposes a method that looks like this:

[WebMethod]
public WebServiceTest. Core.Class1 GetClass1()
{
return new WebServiceTest. Core.Class1();
}

the windows app has a web reference to the webservice (and a reference to the class library).
I want (and even expected) the web-method to return a
WebServiceTest. Core.Class1 object but instead it returns a
WebServicesTest .Client.localho st.Class1 where:
WrbServicesTest .Client is the windows app namespace
localhost is the name of the webreference to the web service
Class1 is some generated class that represents the return type.

my question is simple:

I need the original object. this is why both webservice and windows app reference the shared assembly...
what can I do?
what am I doing wrong?

thanx,

Picho

Nov 23 '05 #3
I completely agree with you when you said things between .Net Remoting
framework and web services, I for once without doubt. 9 out 10 will go for
Web Services. Interoperabilit y and future reuse and security(though this
will change in .Net 2.0). But there are times when Remoting is simply the
only sensible choice. For example the sharing for common types and
interfaces, or when performance is a major consideration.. And this goes
without saying , the system will be very tightly coupled, then again that
what remoting is for.

Regards

Erymuzuan Mustapa

"Christoph Schittko [MVP]" <IN**********@a ustin.rr.com> wrote in message
news:<#b******* *******@TK2MSFT NGP12.phx.gbl>. ..
The same question just came up in microsoft.publi c.dotnet.framew ork.webservices . As erymuzuan pointed out .NET 2.0 will fix the issue once and for all, for now your best choice is to edit the generated files, or even better, write a simple app or a perl script that strips out all redundant classes generated from the WSDL. There's an MSDN article that describes the edits you need [0]. The use of remoting is strongly discouraged [1] at this point with respect to future interoperabilit y issues and a programming model that tempts developers to develop strongly coupled systems based on the distributed object metaphor. Personally, I like the .NET Remoting framework, and I am somewhat disappointed to see such a fine framework go away, but knowing the issues ahead I can no longer recommend building new distributed systems on .NET Remoting. At this point .NET Remoting should strictly be used for intra-process/cross app domain scenarios. HTH, Christoph Schittko MVP XML http://weblogs.asp.net/cschittko [0] http://msdn.microsoft.com/library/en...vice07162002.a sp [1] http://weblogs.asp.net/cschittko/arc...27/143388.aspx
-----Original Message----- From: Picho [mailto:SP****** **@telhai.ac.il] Posted At: Sunday, January 02, 2005 12:31 PM Posted To: microsoft.publi c.dotnet.framew ork.webservices Conversation: web service returned object type problem Subject: web service returned object type problem Hi all. I have a webservice and a windows app. both of them reference the same class library called WebServiceTest. Core that defines a class called Class1. the webservice exposes a method that looks like this: [WebMethod] public WebServiceTest. Core.Class1 GetClass1() { return new WebServiceTest. Core.Class1(); } the windows app has a web reference to the webservice (and a reference to the class library). I want (and even expected) the web-method to return a WebServiceTest. Core.Class1 object but instead it returns a WebServicesTest .Client.localho st.Class1 where: WrbServicesTest .Client is the windows app namespace localhost is the name of the webreference to the web service Class1 is some generated class that represents the return type. my question is simple: I need the original object. this is why both webservice and windows app reference the shared assembly... what can I do? what am I doing wrong? thanx, Picho


Nov 23 '05 #4
Hello Picho,
The 4 tenets of service orientation i.e. Web services, are

* Boundaries are explicit
* Services are autonomous
* Share schema/contract - not class
* Use policy-based assertions

The third tenet is what yr violating by sharing types. Ultimately, web services
are about passing messages, which means these objects get serialized into
xml messages and deserialized on the other side, so as long as you can have
an object on the otherside with the same values that you sent in you should
be in good shape. The actual types and their namespaces dont really matter.
If you must have the same object you can by all means only you may need to
work out some roundabout tweaks. As Christoph suggests, the next version
of wsdl.exe supports sharing types.

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com
http://www.geniant.com
Hi all.

I have a webservice and a windows app.
both of them reference the same class library called
WebServiceTest. Core
that defines a class called Class1.
the webservice exposes a method that looks like this:

[WebMethod]
public WebServiceTest. Core.Class1 GetClass1()
{
return new WebServiceTest. Core.Class1();
}
the windows app has a web reference to the webservice (and a reference
to
the class library).
I want (and even expected) the web-method to return a
WebServiceTest. Core.Class1 object but instead it returns a
WebServicesTest .Client.localho st.Class1 where:
WrbServicesTest .Client is the windows app namespace
localhost is the name of the webreference to the web service
Class1 is some generated class that represents the return type.
my question is simple:

I need the original object. this is why both webservice and windows
app
reference the shared assembly...
what can I do?
what am I doing wrong?
thanx,

Picho

Nov 23 '05 #5
Thanx guys, this realy helped.

"Christoph Schittko [MVP]" <IN**********@a ustin.rr.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..

The same question just came up in
microsoft.publi c.dotnet.framew ork.webservices . As erymuzuan pointed out
.NET 2.0 will fix the issue once and for all, for now your best choice
is to edit the generated files, or even better, write a simple app or a
perl script that strips out all redundant classes generated from the
WSDL. There's an MSDN article that describes the edits you need [0].

The use of remoting is strongly discouraged [1] at this point with
respect to future interoperabilit y issues and a programming model that
tempts developers to develop strongly coupled systems based on the
distributed object metaphor. Personally, I like the .NET Remoting
framework, and I am somewhat disappointed to see such a fine framework
go away, but knowing the issues ahead I can no longer recommend building
new distributed systems on .NET Remoting. At this point .NET Remoting
should strictly be used for intra-process/cross app domain scenarios.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

[0]
http://msdn.microsoft.com/library/en...vice07162002.a
sp

[1] http://weblogs.asp.net/cschittko/arc...27/143388.aspx
-----Original Message-----
From: Picho [mailto:SP****** **@telhai.ac.il]
Posted At: Sunday, January 02, 2005 12:31 PM
Posted To: microsoft.publi c.dotnet.framew ork.webservices
Conversation: web service returned object type problem
Subject: web service returned object type problem

Hi all.

I have a webservice and a windows app.
both of them reference the same class library called

WebServiceTest. Core
that defines a class called Class1.

the webservice exposes a method that looks like this:

[WebMethod]
public WebServiceTest. Core.Class1 GetClass1()
{
return new WebServiceTest. Core.Class1();
}

the windows app has a web reference to the webservice (and a reference

to
the class library).
I want (and even expected) the web-method to return a
WebServiceTest. Core.Class1 object but instead it returns a
WebServicesTest .Client.localho st.Class1 where:
WrbServicesTest .Client is the windows app namespace
localhost is the name of the webreference to the web service
Class1 is some generated class that represents the return type.

my question is simple:

I need the original object. this is why both webservice and windows

app
reference the shared assembly...
what can I do?
what am I doing wrong?

thanx,

Picho


Nov 23 '05 #6
Thanx for the reply Christoph.

I am a bit confused.

when this problem first araised for me while writing a server-client
application, I found a detoured solution. since the data transfer needed to
be secured, I binary serialized the returned object, symmetricly encrypted
it, and so the data transported was allways a byte[].

I can still do this - serializing the object and deserializing it on the
client app back to the shared assembly class.

is this ok?

what should I do?
when is .net 2.0 supposed to be out?

I do not perdict x-platform data transport for my server-client application,
but I would still like to see something smooth and readable (that is - no
serialization.. .).
please note that I go to all this trouble because my objects are not so
simple and need all the capabilities for oo design (polymorphism,
inheritance, interface implementation, events etc) and therefor creating
adapters from the generated schemes to the original classes are out of the
question.

so what do you say?
what should I do NOW in order to be ready for the FUTURE?
use remoting?
serialize and transfer byte[]?
twick the generated files?
"Christoph Schittko [MVP]" <IN**********@a ustin.rr.com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..

The same question just came up in
microsoft.publi c.dotnet.framew ork.webservices . As erymuzuan pointed out
.NET 2.0 will fix the issue once and for all, for now your best choice
is to edit the generated files, or even better, write a simple app or a
perl script that strips out all redundant classes generated from the
WSDL. There's an MSDN article that describes the edits you need [0].

The use of remoting is strongly discouraged [1] at this point with
respect to future interoperabilit y issues and a programming model that
tempts developers to develop strongly coupled systems based on the
distributed object metaphor. Personally, I like the .NET Remoting
framework, and I am somewhat disappointed to see such a fine framework
go away, but knowing the issues ahead I can no longer recommend building
new distributed systems on .NET Remoting. At this point .NET Remoting
should strictly be used for intra-process/cross app domain scenarios.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

[0]
http://msdn.microsoft.com/library/en...vice07162002.a
sp

[1] http://weblogs.asp.net/cschittko/arc...27/143388.aspx
-----Original Message-----
From: Picho [mailto:SP****** **@telhai.ac.il]
Posted At: Sunday, January 02, 2005 12:31 PM
Posted To: microsoft.publi c.dotnet.framew ork.webservices
Conversation: web service returned object type problem
Subject: web service returned object type problem

Hi all.

I have a webservice and a windows app.
both of them reference the same class library called

WebServiceTest. Core
that defines a class called Class1.

the webservice exposes a method that looks like this:

[WebMethod]
public WebServiceTest. Core.Class1 GetClass1()
{
return new WebServiceTest. Core.Class1();
}

the windows app has a web reference to the webservice (and a reference

to
the class library).
I want (and even expected) the web-method to return a
WebServiceTest. Core.Class1 object but instead it returns a
WebServicesTest .Client.localho st.Class1 where:
WrbServicesTest .Client is the windows app namespace
localhost is the name of the webreference to the web service
Class1 is some generated class that represents the return type.

my question is simple:

I need the original object. this is why both webservice and windows

app
reference the shared assembly...
what can I do?
what am I doing wrong?

thanx,

Picho


Nov 23 '05 #7

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

Similar topics

2
4957
by: Richard Collette | last post by:
Hi, I have a service, that runs perfectly when executed outside of the web service environment. When called as a web service I get the exception listed below sporadically. A call to the web method may succeed one time and not another. I cannot find any reason why it would work one time and not another. The exception occurs every two or three calls to the web method. The service utilizes a COM component provided by PeopleSoft...
6
343
by: Jim S | last post by:
I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice that communicate on the same LAN. The Pocket PC has no problem consuming strings returned from the web service methoeds but I’m unable to receive and a custom object. The error occurs when the PocketPC app casts a returned object (WebServiceServer.objectA) from the webservice to pocketPC.ObjectA (results in InvalidCastExeption). ObjectA is a simple class and is...
2
2800
by: Jim S | last post by:
I have a .net framework 2.0 client (Pocket PC) and a .net 2.0 webservice that communicate on the same LAN. The Pocket PC has no problem consuming strings returned from the web service methoeds but I’m unable to receive and a custom object. The error occurs when the PocketPC app casts a returned object (WebServiceServer.objectA) from the webservice to pocketPC.ObjectA (results in InvalidCastExeption). ObjectA is a simple class and is...
3
6627
dmjpro
by: dmjpro | last post by:
plz send me a good link which can clearify me how the J2EE framework works i want the details information .... plz help thanx
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.