How can I create the service contract to be in XmlSerializerFormat as well as WebMessageFormat.Json within a WCF RESTful service.
What I need is to call the "CallADSWebMethod" operation contract from code behind of ASP.Net 1.1 which needs to be XML serialized and from jQuery ajax which is Json serialized.
SERVICE CONTRACT
[ServiceContract, XmlSerializerFormat]
public interface IService
{
[OperationContract, XmlSerializerFormat]
[WebInvoke(UriTemplate = "/CallADSWebMethod",
Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
VINDescription CallADSWebMethod(string vin, string styleID);
}
Endpoint Info
<endpoint address="basic"
binding="basicHttpBinding"
name="httpEndPoint"
contract="ADSChromeVINDecoder.IService" />
<endpoint address="json"
binding="webHttpBinding"
behaviorConfiguration="webBehavior"
name="webEndPoint"
contract="ADSChromeVINDecoder.IService" />
<endpoint contract="IMetadataExchange"
binding="mexHttpBinding"
address="mex" />