I have a web service as below,
[ServiceContract]
public interface IRestServiceImpl
{
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "json/{jsondata}")]
void JSONData(string jsondata);
}
public class RestServiceImpl : IRestServiceImpl
{
List<ClsTripAdvisorData> lst = new List<ClsTripAdvisorData>();
ClsTripAdvisorData _ClsTripAdvisorData = null;
#region IRestServiceImpl Members
public void JSONData(string jsondata)
{
string[] data = jsondata.Split('&');
}
}
Its expecting a JSON input. while i am testing this service with poster by passing a JSON string as query string request as below,
http://localhost:1162/RestServiceImpl.svc/json/api_version=4 &hotels=[{"ta_id":97497,"partner_id":"229547","partner_url":"http://partner.com/deeplink/to/229547"},{"ta_id":97832,"partner_id":"id34234","partner_url":"http://partner.com/deeplink/to/id34234"}] &start_date=2013-07-01 &end_date=2013-07-03 &num_adults=2 &num_rooms=1 &lang=en_US ¤cy=USD &user_country=US &device_type=d &query_key=6167a22d1f87d2028bf60a8e5e27afa7_191_1360299600000_2_2
Here my string parameter is api_version=4 &hotels=[{"ta_id":97497,"partner_id":"229547","partner_url":"http://partner.com/deeplink/to/229547"},{"ta_id":97832,"partner_id":"id34234","partner_url":"http://partner.com/deeplink/to/id34234"}] &start_date=2013-07-01 &end_date=2013-07-03 &num_adults=2 &num_rooms=1 &lang=en_US ¤cy=USD &user_country=US &device_type=d &query_key=6167a22d1f87d2028bf60a8e5e27afa7_191_1360299600000_2_2
Its not hitting the service method break point while debugging.
At the same time its working for the following JSON as below,
http://localhost:1162/RestServiceImpl.svc/json/asd
The service method not taking the JSON string input,
I just want send this string as body part of my web service.But i dont know how to send and receive this json string using wcf rest service