Re: Sharing Types between Webservice and Client
From: Martin Ehrlich (martin.ehrlich_at_gmx.de)
Date: 01/14/05
- Next message: Mona: "Re: WaitOne vs WaitMany"
- Previous message: vigori: "Re: WebException HTTP 400 depending size of attachment"
- In reply to: William Stacey [MVP]: "Re: Sharing Types between Webservice and Client"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 Jan 2005 11:03:25 +0100
The wsdl file contains the right namespaces. But the proxy contains
xsd-generated types instead of the types from the shared assembly, which I
have to change manually.
-Martin
"William Stacey [MVP]" <staceywREMOVE@mvps.org> schrieb im Newsbeitrag
news:eOjgNAg%23EHA.3124@TK2MSFTNGP11.phx.gbl...
> Is your wsdl already creating the type in another namespace. So it
> creates
> that type and you can't cast that type to your manual type. Check your
> .cs
> files (view all files) to see what types have been automatically generated
> and their namespaces, etc.
>
> --
> William Stacey, MVP
> http://mvp.support.microsoft.com
>
> "Martin Ehrlich" <martin.ehrlich@gmx.de> wrote in message
> news:OtwQNHb#EHA.2032@tk2msftngp13.phx.gbl...
>> Hello NG.
>>
>> I've got a little problem with sharing types between webservices and
>> clients.
>>
>> I've created a business class with public fields within a shared assembly
>> like:
>>
>> public class Item
>> {
>> public System.Guid UID
>> public System.String Displayname
>> public DateTime LastChanged
>> }
>>
>> A corresponding webservice use this class and returns it.
>>
>> [WebMethod()]
>> public Item GetItem()
>> {
>> Item i = new Item();
>> i.UID = Guid.NewGuid();
>> i.Displayname = "New Item";
>> i.LastChanged = DateTime.Now;
>> return i;
>> }
>>
>> I've also created a client application that consumes this webservice.
>> Webservice and client are sharing the same assembly which contains the
> class
>> "Item". Now I want to get the Item-object from the proxy, but because the
>> proxy generator creates his own class definition of "Item" out of the
>> wsdl-file, I cannot cast the webservice method return value to the
> business
>> object.
>>
>> DataServices.ItemService service = new DataServices.ItemService();
>> Item i = service.Getitem();
>>
>> I've made some research on this problem and discovered, that there is
>> only
>> one way to manage this by editing the proxy-generated file
>> "reference.cs".
>> This have to be done every time the webservice is changing. But there was
>> something wired about that.
>>
>> If I'm returning a DataSet object or a XmlNode or XmlDocument, I get the
>> right type back, why is that so? I've checked if they have implemented
> some
>> interfaces on these classes, but that's not the case.
>>
>> My question now is: Is there any way to make my own classes behaving like
>> XmlNode or XmlDocument? Maybe an attribute? Or Interface?
>>
>> I'm currently using NET v1.1 and VS2003.
>>
>> -Martin
>>
>>
>>
>>
>
- Next message: Mona: "Re: WaitOne vs WaitMany"
- Previous message: vigori: "Re: WebException HTTP 400 depending size of attachment"
- In reply to: William Stacey [MVP]: "Re: Sharing Types between Webservice and Client"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|