Re: how or when to use XmlInclude ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Dan Rogers (danro_at_microsoft.com)
Date: 12/10/04


Date: Fri, 10 Dec 2004 18:16:44 GMT

This is just a behavior of the shallow reflection used to paint the
documentation page. In general, you need to use a properly created proxy
to actually call the service - and that proxy relies on the contract, not
on the server side implementation.

I think you'll find that the proxy defines the right inheritence structure
for the data items that are public and serialized to the wire. There won't
be any callable methods on the data objects, since this is not object
remoting, it is a contract bound interface only that makes the data on the
wire the bridge between systems.

--------------------
>From: "R.A." <temp@hotmail.com>
>References: <u7qQg2G3EHA.3820@TK2MSFTNGP11.phx.gbl>
<1KaIaFJ3EHA.3200@cpmsftngxa10.phx.gbl>
>Subject: Re: how or when to use XmlInclude ?
>Date: Wed, 8 Dec 2004 09:03:58 -0600
>Lines: 97
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
>Message-ID: <Olu0ocT3EHA.1396@tk2msftngp13.phx.gbl>
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
>NNTP-Posting-Host: 204.124.82.48
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:27090
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
>Thanks,
>
>Then why is it that when I view the web service method (using MS IE) I see
>the method return type MyClass only? MyClass is derived from an abstract
>class and I would like the consumer of the web service to be able to read
>the public methods of the abstract class also. What I have now is that I
>only see the MyClass methods in the IE when I click on that web service
>method (see it in soap protocol).
>
>public abstract class ABC
>{
> public string Phone;
>}
>
>public class MyClass : ABC
>{
> public string Name;
> public string Street;
>}
>
>Thanks
>
>"Dan Rogers" <danro@microsoft.com> wrote in message
>news:1KaIaFJ3EHA.3200@cpmsftngxa10.phx.gbl...
>> In this case you don't need to use XmlInclude. You would only need the
>> XmlInclude if you had an interface that included the ability for
different
>> types than expected at compile time to be added to the return at runtime.
>> This happens when you return an object as the return type, for instance.
>>
>> Regards,
>>
>> Dan Rogers
>> Microsoft Corporation
>> --------------------
>> >From: "R.A." <temp@hotmail.com>
>> >Subject: how or when to use XmlInclude ?
>> >Date: Tue, 7 Dec 2004 09:01:24 -0600
>> >Lines: 38
>> >X-Priority: 3
>> >X-MSMail-Priority: Normal
>> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
>> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
>> >Message-ID: <u7qQg2G3EHA.3820@TK2MSFTNGP11.phx.gbl>
>> >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
>> >NNTP-Posting-Host: 204.124.82.48
>> >Path:
>>
>cpmsftngxa10.phx.gbl!TK2MSFTNGXS01.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP0
8
>> phx.gbl!TK2MSFTNGP11.phx.gbl
>> >Xref: cpmsftngxa10.phx.gbl
>> microsoft.public.dotnet.framework.aspnet.webservices:27071
>> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>> >
>> >Hi
>> >
>> >I have a web service that returns a custom class in one of the service
>> >methods.
>> >
>> >public class MyClass
>> >{
>> > public string Name;
>> > public string Street;
>> >}
>> >
>> >
>> >web method:
>> >
>> >[WebMethod (Description = "Get customer info")]
>> >public MtClass [] GetCustomerList (string ZipCode)
>> >
>> >{
>> >
>> >...
>> >
>> >}
>> >
>> >
>> >
>> >As I am testing I didn't use XmlInclude for MyClass or for the
>> >GetCustomerList method but still I am able to get the serialized
>> information
>> >back from the web service. If this is the case then do I need XmlInclude
>at
>> >all?
>> >
>> >
>> >
>> >Thanks
>> >
>> >
>> >
>> >
>> >
>> >
>>
>
>
>



Relevant Pages

  • Re: Passing User Define class to web service.
    ... First, you should try to update your web reference, then go to the generated ... that when the new web service proxy is ... >> likely problem is that myClass is multiply defined in separate namespaces ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Convert proxy type to class type
    ... I thought about the sync issue but since the client needs all the data ... I have a web service, class library (this class library is used in many ... classes that will take the generated proxy class and create a new class from ... >>the proxy will be a deserialized version of MyClass but under the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Convert proxy type to class type
    ... I thought about the sync issue but since the client needs all the data ... I have a web service, class library (this class library is used in many ... classes that will take the generated proxy class and create a new class from ... >>the proxy will be a deserialized version of MyClass but under the ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Convert proxy type to class type
    ... couple the web service and the client by sharing a common type. ... >public MyClass Test(); ... >the proxy will be a deserialized version of MyClass but under the namespace ... >of the generated proxy. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Convert proxy type to class type
    ... couple the web service and the client by sharing a common type. ... >public MyClass Test(); ... >the proxy will be a deserialized version of MyClass but under the namespace ... >of the generated proxy. ...
    (microsoft.public.dotnet.languages.csharp)