ASMX services and [Serilizable] tag on Entities/models

נעול ASMX services and [Serilizable] tag on Entities/models

  • 05 Maret 2012 8:23
     
     

    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


    • Diedit oleh Tiya01 05 Maret 2012 9:35
    •  

Semua Balasan

  • 05 Maret 2012 13:58
    Moderator
     
     

    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

  • 06 Maret 2012 5:45
     
     

    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

  • 12 Maret 2012 16:17
    Moderator
     
     

    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

  • 13 Maret 2012 4:04
     
     

    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 Maret 2012 5:45
    Moderator
     
     Jawab
    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

    • Ditandai sebagai Jawaban oleh Tiya01 13 Maret 2012 6:31
    •  
  • 13 Maret 2012 6:31
     
      Memiliki Kode

    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 Maret 2012 11:56
    Moderator
     
     Jawab

    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

    • Ditandai sebagai Jawaban oleh Tiya01 13 Maret 2012 12:12
    •  
  • 13 Maret 2012 12:12
     
     

    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