Search code examples
xmlweb-serviceswcfsoapasmx

Do SOAP services return XMl or a class?


I am not a master of Web web services but I have had a chance to work with/consume all the three major kind

  • SOAP
    • WCF
    • ASMX
  • REST

Now, speaking of consuming SOAP. I have not worked very closely with ASMX but I know that if we are in WCF environment then we have a DataContract in in RESTFul, we have DTO that are basically data getting transported from server to Client through webservice.

When we add WCF Service reference in our code, it also creates this "Reference.cs" which downloads all the TYPE information in the client side and we don't even feel that it is SOAP based XML

However though, I have worked with some third parties who host Webservice URL and when we call their services, what comes out is Raw XML. Now, why is that? Under what condition client would end up with a raw XML and not a Class?

  • is it because they are using a classic architecture like ASMX?
  • Can it be by Design?
    • If so, what is benefit of spitting out XML and having client go through hassle of mapping it to an object?
  • Can ASMX spit out something like a DataContract?

Solution

  • To answer the questions particularly asked in the original question

    is it because they are using a classic architecture like ASMX?

    • Mostly, these days we can see the XML coming through is because of absence of WCF and DataContract serialization. So it is more likely than less that it is classic ASMX

    Can it be by Design?

    • If it could be done by DataContract but still done as XMlContract then it can not be most effecient design. Until and unless there were reasons for which it was done

    Can ASMX spit out something like a DataContract?

    • No.