WCF Service and Message

Hi All,

I have a question on a WCF Service.

Lets say I have a customer that is sending me a set of transactions. Those transactions deal with cars.

And I know this is in a soap message but let's say the list of transactions are like something in simplistic terms like:

Cavelier, 1986, 10000, damaged
GMC Sierra, 2013, 40000, new
Dodge Ram, 2014, 45000, new
Lexus IS300, 2006, totaled

How would the operationcontract for that submission be done? Is that a LIST object of the operation contract and then I would have to iterate through the LIST?

Any information on that would be greatly appreciated.

Who is Participating?
bhmahlerConnect With a Mentor Commented:
You would need to create a DataContract for the car object.  You would create your class and give it the [DataContract] attribute.  Then in your method, you can accept an array or list of car object so...

public string AddCars(List<Car> cars);
It is all how you want to set it up.  If you create a car object, you can then setup your method to take a list of cars and then iterate through them when you receive it.  It all comes down to how you define it.
davismAuthor Commented:
What is the standard way? As with a wcf service is it not coming across as a soap message (so basically an XML).

In addition, if I had a car object would not the WSDL create a complex-type and a sequence?

So if I have something like, for example:

string CarList(objCar ListCar)

Would that handle it? Or would I need something like:

string CarList(List<objCar> ListCar)

The first is accepting the object but the second is accepting the list (or array) of the object.  I would think the second one but I'm not completely sure. I have been told the first one will be good because the WSDL shows the complex type and the sequence.
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

davismAuthor Commented:
Yep, have the DataContract with all the DataMembers for the car object.

I just was not completely sure on the "List<Car> cars" or just the "Car cars" part of the operation contract.

So, if I do not have the "List<Car> cars" it would not process multiple transactions even though the WSDL has the Complex type and the sequence?
davismAuthor Commented:
Does anyone have and information on this? I'm not seeing how it is possible but am I missing something? I have to think I am.
davismAuthor Commented:
I am not finding much information on the ComplexType and the Sequence. It's in the XSD, yes, but that is generated from teh VS and Addition of the Service Reference. I have seen if you have a string, int or something like that it will create a simpletype but when you use an object or array (which is an object) it will create a complextype.

All-in-all, the LIST will need to be done.

Really appreciate the information.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.