Passing custom objects to a web service

前端 未结 4 1058
盖世英雄少女心
盖世英雄少女心 2021-02-07 16:17

I have a need to pass a custom object to a remote web service. I have read that it may be necessary to implement ISerializable, but I\'ve done that and I\'m encountering difficu

4条回答
  •  暖寄归人
    2021-02-07 16:49

    Looks like a duplicate to this question

    Anyway, all objects involved in WS interactions should be XML-serializable, not ISerializable (which is binary serialization). Moreover, they should be described in the service contract (WSDL), otherwise clients won't be able to consume them. This article should be useful to understand XML-serialization with XML Web Services.

    However, if you are talking about really custom objects (i.e. any type). You should consider passing them in binary form: either as base64-encoded, or as attachments. The question I linked to has an answer how to do that.

提交回复
热议问题