Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2004

Tip: Looking for answers? Try searching our database.

How to pass a class as a parameter to a web service ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chakra - 12 Dec 2004 13:21 GMT
I have a Entity class defined in a assembly. I then have a web service in
the same solution, which takes an object of this class as a parameter. It
expects me to give the fully qualified name of this parameter (complete
namespace and class in the proxy), - so we have to go and change the proxy
by hand, because it assumes that the class definition would belong to the
web service. How can this be avoided ?
Dino Chiesa [Microsoft] - 13 Dec 2004 16:01 GMT
I don't know of a way.

Is it a great hardship to modify the proxy?

Webservices is a message-based communication model, not a class-based one.
This is the root of the problem you are experiencing.  Another option is to
design your webservice interface by starting with the message schema first,
rather than by starting with the class.

See here for more on that:
http://pluralsight.com/blogs/aaron/archive/2004/11/11/3432.aspx

-D

>I have a Entity class defined in a assembly. I then have a web service in
> the same solution, which takes an object of this class as a parameter. It
> expects me to give the fully qualified name of this parameter (complete
> namespace and class in the proxy), - so we have to go and change the proxy
> by hand, because it assumes that the class definition would belong to the
> web service. How can this be avoided ?
chak - 13 Dec 2004 17:31 GMT
Thanks for your reply.

Well, modifying the proxy is alright , but every time the web reference is
refreshed in VS.NET, the proxy gets regenerated and the parameters have to
be re-qualified.

One workaround i MAY have found is to use the same namespace for the custom
class and the web service. It appears to be accepting the custom class
parameter now (touchwood).

>I don't know of a way.
>
[quoted text clipped - 17 lines]
>> by hand, because it assumes that the class definition would belong to the
>> web service. How can this be avoided ?
Mujtaba Syed - 13 Dec 2004 19:19 GMT
Hi Chak:

> Well, modifying the proxy is alright , but every time the web reference is
> refreshed in VS.NET, the proxy gets regenerated and the parameters have to
> be re-qualified.

The problem of proxy changes being overwritten everytime you refresh web
references is very real. The web services team has been working on this.
With .NET 2.0 they are introducing something called 'Schema Importer
Extentions' that offer greater control over proxy generation. You would
write a type which inherits from SchemaImporterExtension and then register
it with the web services infrastructure (eg. web.config).

Mujtaba.

> One workaround i MAY have found is to use the same namespace for the custom
> class and the web service. It appears to be accepting the custom class
> parameter now (touchwood).

Yes. This is guaranteed to work as during resolution the current namespace
is searched first.

> >I don't know of a way.
> >
[quoted text clipped - 22 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.809 / Virus Database: 551 - Release Date: 12/9/2004

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.