RE: Help! Web service can't be accessed!
From: Dan Rogers (danro_at_microsoft.com)
Date: 03/07/05
- Next message: Dan Rogers: "RE: compile the proxy code error in .net 2003 command promp"
- Previous message: Kris Kanthi via .NET 247: "Web Services using custom types - issue as it is redefining them in the proxy class generated."
- In reply to: James: "Help! Web service can't be accessed!"
- Messages sorted by: [ date ] [ thread ]
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.
>
- Next message: Dan Rogers: "RE: compile the proxy code error in .net 2003 command promp"
- Previous message: Kris Kanthi via .NET 247: "Web Services using custom types - issue as it is redefining them in the proxy class generated."
- In reply to: James: "Help! Web service can't be accessed!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|