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?
精彩评论