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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.