user1668123
user1668123

Reputation: 105

How to pass an entity via a Web Service

Is there a way to pass the data as an entity within another entity? What I'm trying to get to is this: I'm passing customer details to my database, via the webmethod : PostData. What I want is to pass details such as name, surname, etc as string, but I want to group some details, like vehicle details to be passed as : vehicle.Manufacturer vehicle.Model... etc The other data that are not group-able will be passed as an ordinary string. Hope that makes sense. Is there a way to do this?

Upvotes: 0

Views: 232

Answers (1)

Vineet Singla
Vineet Singla

Reputation: 1677

You can do this either by XML or JSON, so the object that in the part of request will be like in XML :

<VehicleEntity>
    <attribute1>value</attribute1>
    <attribute2>value</attribute2>
 </VehicleEntity>

or Similarly using JSON

VehilceEntity{
 attribute1 :value;
 attribute2 :value;
}

Basically it is similar to how you are passing parameter, here it is custom parameter VehicleEntity

Upvotes: 1

Related Questions