Atlas client-server binding issue (getter)

Discussion in 'ASP .Net' started by Amie, May 8, 2007.

  1. Amie

    Amie Guest

    Hi,

    I have an atlas related question..

    I have a web form that submits the information to a web service
    method, and it's done thru Atlas by binding the web methods to client
    functions.

    It seems to be working fine, except for when the class has a property
    with only getter (no setter), it freaks out, and returns the following
    error:

    new Sys.Net.MethodRequestError("The type \'Project\' does not have a
    public property or field named

    \'StartDateDisplay\'"," at
    Microsoft.Web.Script.Serialization.ObjectConverter.AssignToPropertyOrField

    (Object propertyValue, Object o, String memberName)\r\n at
    Microsoft.Web.Script.Serialization.ObjectConverter

    ..ConvertDictionaryToObject(IDictionary`2 dictionary, Type type)\r\n
    at Microsoft.Web.Script.Serialization

    ..ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type)\r
    \n at Microsoft.Web.Script.Serialization

    ..ObjectConverter.ConvertObjectToType(Object o, Type type)\r\n at
    Microsoft.Web.Services.WebServiceMethodData

    ..StrongTypeParameters(IDictionary`2 rawParams)\r\n at
    Microsoft.Web.Services.WebServiceMethodData.CallMethodFromRawParams

    (Object target, IDictionary`2 parameters)\r\n at
    Microsoft.Web.Services.RestHandler.ProcessRequest

    (HttpContext context)","System.ArgumentException")

    The Project class has a property called "StartDateDisplay" but it's a
    getter. Is Atlas unable to map a client object to a server object if
    the server class def contains a property with only getter? Is there a
    workaround to this?

    I have other classes with getter properties, so I'd like to get it
    working as is without removing them.

    Thanks in advance,
    Amie
     
    Amie, May 8, 2007
    #1
    1. Advertising

  2. Amie

    marss Guest

    Amie wrote:
    > Hi,
    >
    > I have an atlas related question..
    >
    > I have a web form that submits the information to a web service
    > method, and it's done thru Atlas by binding the web methods to client
    > functions.
    >
    > It seems to be working fine, except for when the class has a property
    > with only getter (no setter), it freaks out, and returns the following
    > error:
    >
    > new Sys.Net.MethodRequestError("The type \'Project\' does not have a
    > public property or field named
    >
    > \'StartDateDisplay\'"," at
    > Microsoft.Web.Script.Serialization.ObjectConverter.AssignToPropertyOrField
    >
    > (Object propertyValue, Object o, String memberName)\r\n at
    > Microsoft.Web.Script.Serialization.ObjectConverter
    >


    Hi, I guess a problem is not in Atlas. You trying to serialize an
    object of the class which has a property that can not be serialized.
    Try to explicitly exclude this property from the serialization.

    [Serializable]
    public class Project
    {
    public bool NormalProperty
    {
    get { ... }
    set { ... }
    }

    [NonSerialized]
    public string StartDateDisplay
    {
    get { ... }
    }
    }
     
    marss, May 8, 2007
    #2
    1. Advertising

  3. Amie

    Amie Guest

    Thanks for the response!

    I couldn't attach the attribute [Nonserialized] for the property as
    it's allowed for field declaration only.

    I got around by having an empty setter.. Probably not a best solution,
    but it works.
     
    Amie, May 9, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jc1771
    Replies:
    2
    Views:
    1,056
    jc1771
    Sep 10, 2003
  2. Raoul Markus
    Replies:
    3
    Views:
    1,136
    Roedy Green
    Sep 20, 2003
  3. Timo Nentwig
    Replies:
    75
    Views:
    3,367
    Jon A. Cruz
    Jan 18, 2004
  4. goa_head
    Replies:
    6
    Views:
    9,984
    Andrew Thompson
    Apr 25, 2004
  5. Replies:
    0
    Views:
    317
Loading...

Share This Page