WCF service, response in SOAP or plain XML, how?

The service you have here will return a SOAP message - which will contain the "CompositeType" as its "payload.

The service you have here will return a SOAP message - which will contain the "CompositeType" as its "payload". WCF by default uses SOAP - any of the basicHttpBinding, wsHttpBinding, netTcpBinding etc. All work with SOAP as their basis. If you want to return straight XML, you need to check out the REST capabilities of WCF - this works with the webHttpBinding (and only that binding).

Also, how to produce an XML like this (based on data contract): rather than this: 0 This is a limitation of the WCF DataContract serializer. For performance reasons, it does not support attributes, e.g. You cannot create the first fragment of XML that you want. If you absolutely must have the first XML, you'll need to use the XmlSerializer instead (which has its own set of limitations / problems).

Marc UPDATE: if you just want to return a given XML, then you're probably better off with the REST approach. Check out the Pluralsight website for an excellent series of screencasts on using REST and in particular, one screencast on how to create a plain-old XML (POX) REST service.

– Wodzu Sep 29 '09 at 10:34 No - you can still use contracts, but use the XML Serializer instead of the DataContractSerializer, if you really MUST have the format you're looking for. But this will still be a SOAP response. – marc_s Sep 29 '09 at 10:47 marc_s: Thank you.

The specification doesn't say anything about SOAP. So I guess I need to send and receive just an XML without any envelope. This XML need to have attributes as I have shown it in my question.

Can I ask you to show me how to use XMLSerializer? This is 5th hour I am spendig on looking for an answer and I am so frustrated ;) – Wodzu Sep 29 '09 at 10:58 After second thought: are you saying that I can not send a simple XML with attributes without using SOAP? – Wodzu Sep 29 '09 at 11:07 @wodzu: no, you definitely can - if you're using the REST approach, it's totally up to you how to define the response being sent back – marc_s Sep 29 '09 at 15:56.

Take a look at Enunciate. I've used it before to create a REST (XML && JSON) interface as well as a SOAP interface. It might give you exactly what you're looking for and it's pretty easy to work with.

The lead developer is also quite active on the mailing list so if you have questions just send the group a message and you'll usually get a response very quickly.

Thanks Randyaa, will look on that. – Wodzu Sep 29 '09 at 19:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions