locked
ASMX services and [Serilizable] tag on Entities/models

    Soru

  • I have a query regarding ASMX webservices. I have worked upon it in 2.0 and also dont have much exposure on the same.

    While working with web services I was not required to add [Serilizable] tag to the entity/model that is sent across the network.

    1. Is it something like the ASMX Webservices have built in serialization?
    2. If yes, is it required to set the [Serilizable] tag on coressponding Entity/Model for performing serialization?
    3. If no, then without serialization how data is sent across the network?
    I am a beginner so pls guide me.

    Thanks!


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful


    • Düzenleyen Tiya01 05 Mart 2012 Pazartesi 09:35
    05 Mart 2012 Pazartesi 08:23

Yanıtlar

  • I don't know that I would call it "inbuilt". ASMX web services use the XML Serializer. This is why [Serializable] is not used - the XML Serializer does not use it.

    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    • Yanıt Olarak İşaretleyen Tiya01 13 Mart 2012 Salı 06:31
    13 Mart 2012 Salı 05:45
    Moderatör
  • Yes. Just like with WCF, you do not need to write your own serialization when using ASMX web services.

    Do remember that you should not be using ASMX services in new development.


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    • Yanıt Olarak İşaretleyen Tiya01 13 Mart 2012 Salı 12:12
    13 Mart 2012 Salı 11:56
    Moderatör

Tüm Yanıtlar

  • The [Serializable] attribute is not used by the XML serialization technology that is used with ASMX web services.

    I will presume that you are aware that ASMX web services is a legacy technology and should not be used for new development.


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    05 Mart 2012 Pazartesi 13:58
    Moderatör
  • I will presume that you are aware that ASMX web services is a legacy technology and should not be used for new development.

    Yes, I know the new development is being done on WCF.

    But I am still not clear with the points that I have described in my last post.

    Can you pls provide some link or suggest some answers to them.

    Thanks!


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    06 Mart 2012 Salı 05:45
  • The answer is that [Serializable] is not used at all.

    What actual problem are you having?


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    12 Mart 2012 Pazartesi 16:17
    Moderatör
  • Hi John,

    Is it like.. ASMX webservices have inbuilt XML serialization feature associated with them?

    Thanks for your valuable time and feedback.


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    13 Mart 2012 Salı 04:04
  • I don't know that I would call it "inbuilt". ASMX web services use the XML Serializer. This is why [Serializable] is not used - the XML Serializer does not use it.

    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    • Yanıt Olarak İşaretleyen Tiya01 13 Mart 2012 Salı 06:31
    13 Mart 2012 Salı 05:45
    Moderatör
  • That means [Serializable] is required for other serializers like binary,custom etc.

    One more point that keeps me confused.

    While using ASMX services I used to send the collection (list) via service to DAL and no serialization code was written.

    I dint wrote anything like this

     XmlSerializer xmlSerializer = new XmlSerializer(this.GetType());
                        StringWriter strWriter = new StringWriter();
                        xmlSerializer.Serialize(strWriter, this);
                        return strWriter.ToString();

    So is it possible to send data across the n/w with XMLSerialization without using above code?

    Thanks.


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    13 Mart 2012 Salı 06:31
  • Yes. Just like with WCF, you do not need to write your own serialization when using ASMX web services.

    Do remember that you should not be using ASMX services in new development.


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    • Yanıt Olarak İşaretleyen Tiya01 13 Mart 2012 Salı 12:12
    13 Mart 2012 Salı 11:56
    Moderatör
  • Thanks a ton John..

    It's clear to me now :)


    Every day its a new learning. Keep Learning!!
    If this post answers your question, please click Mark As Answer . If this post is helpful please click Mark as Helpful

    13 Mart 2012 Salı 12:12