RE: Help! Web service can't be accessed!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Dan Rogers (danro_at_microsoft.com)
Date: 03/07/05


Date: Mon, 07 Mar 2005 19:08:41 GMT

Try not to design classes like this. What are you trying to accomplish?
Have two fields with one accessor? Or have one override the definition of
the other? Or is this just a mistake on your part?

Try to put a specific XmlElementAttribute on each name property - don't
just change the one. Do both, to remove the ambiguity.
--------------------
>Thread-Topic: Help! Web service can't be accessed!
>thread-index: AcUeCldcUf2nKCTvSqimQaJMt0hT/A==
>X-WBNR-Posting-Host: 61.149.242.79
>From: "=?Utf-8?B?SmFtZXM=?=" <James@discussions.microsoft.com>
>Subject: Help! Web service can't be accessed!
>Date: Mon, 28 Feb 2005 18:57:01 -0800
>Lines: 45
>Message-ID: <FB64C801-D1ED-4967-B342-1F404E7C2EF9@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
>Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTCMTY1.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:28345
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
>I encountered a problem caused by calling a web method and returning a
>derived class one of whose property overrides its base property.
>
>Definitions of the two classes are as follows:
> public class Class1
> {
> public Class1()
> {
> }
>
> public string Name;
> }
>
> public class Class2 : Class1
> {
> public Class2()
> {
> }
>
> public new string[] Name;
> }
>
>the web method is as follows:
> [WebMethod]
> public Class2 Test()
> {
> return new Class2();
> }
>
>I can compile it correctly, however, an exception was thrown when
referring
>the web service:
>
>Member Class2.Name of type System.String[] hides base class member
>Class1.Name of type System.String. Use XmlElementAttribute or
>XmlAttributeAttribute to specify a new name.
>
>I don't know how to use XmlAttributeAttribute or
>XmlElementAttributeAttribute class to solve the problem, but I tried the
>following style and failed:
>
> [XmlElement("Class2Name", typeof(string[])),
> XmlElement("Class1Name", typeof(string))]
> public new string[] Name;
>
>Any ideas will be greatly appreciately and thanks in advance.
>



Relevant Pages

  • Re: serialization error : need to change maxStringContentLength default setting
    ... In exactly which config files should I be changing the value of maxStringContentLength? ... you're talking about ASP.NET Legacy Web service and not an ASP.NET WCF Web service. ... It's the same kind of thing you would use to override maxStringContentLength, which an entry should be made in the Web.config. ... In WCF Web service the max size for the property in 2 trillion something as the number that can be given on the override. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Web service to ruin under a certain NT account
    ... you can then override this in your web.config (Of course you can just set ... This way I can give the special account ... > access privileges to a file directory and remove all other access rights. ... > This will cause users to use the web service to access the files. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • How Can I overide a function in an existing class
    ... I am using ZSI SOAP library for a web service. ... I cannot make a new class derived from BaseHTTPServer and override the ... log_message function because I can't change the web server object used ... I also can't redirect stderr because the service messes with stdout ...
    (comp.lang.python)