O'Reilly logo

Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications by Steven Cheng

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using raw XML as an operation parameter

WCF service operation calls are transferred as SOAP messages (of XML format) over the transport layer. These kinds of SOAP XML messages are automatically generated via the WCF message/data serialization system. In addition to this, we can also explicitly return custom data of raw XML format.

How to do it...

To return raw XML format data, the simplest way is using a .NET built-in XML data type, such as System.Xml types or LINQ to XML types. In our sample service, we use the XElement type of LINQ to XML to return some custom XML data in service operation.

The following code shows the ServiceContract of the sample service:

[ServiceContract] public interface IService1 { [OperationContract] XElement GetXmlData(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required