operation contract in the interface for the WCF service
[OperationContract]
[WebInvoke(Method = "GET",
BodyStyle = WebMessageBodyStyle.Bare,
RequestFormat = WebMessageFormat.Xml,
ResponseFormat = WebMessageFormat.Xml,
UriTemplate = "/ValidateXMLData?inputData={inputData}")]
string ValidateXMLData(string inputData);
In the .svc file do the implementation for the interface.
public string ValidateXMLData(string inputData)
{
string validatedString=string.Empty;
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(inputData);
validatedString = inputData;
}
catch (Exception ex)
{ }
return validatedString;
}
service configuration in your web.Config file
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="MyService.Services.RestService">
<endpoint address="XML"
behaviorConfiguration="restPoxBehavior"
binding="webHttpBinding"
contract="MyService.Contracts.IRestService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restPoxBehavior">
<webHttp helpEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>