开发者

How to pass Complex Type parameters in a service contract

开发者 https://www.devze.com 2023-03-17 14:59 出处:网络
This is an already existing XML request format corresponding to which I have to implement a web service that will accept this request in this format below.

This is an already existing XML request format corresponding to which I have to implement a web service that will accept this request in this format below.

(Method or operation Name) (complex type1) (complex type2) (complex type3) (some primitive data type1) xyz (/some primitive data type) (some primitive data type2) abc (/some primitive data type) (/complex type3) (/complex type2) (/complex type1) (/Method or operation Name)

I have never written a web service before and had been reading about service contracts and data contracts from past 2 days.

What I know, To create a service contract

[ServiceContract]
define Interface MyServiceContract
{
[OperationContract]
declare Method or Operation name开发者_运维知识库(parameters) //How to pass complex types here?
}


You should define a class whose instance will be passed as a parameter to the OperationContract method and mark this class with the DataContract attribute. The Using Data Contracts topic contains the code example. Does this help?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号