0

I have WCF webservice that has contract like this

[OperationContract]
void UpdateEncounterStatus(int BookingID, string BookingStatus);

and in the class

        [WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "UpdateEncounterStatus/{BookingID}/{BookingStatus}")]
        public void UpdateEncounterStatus(int BookingID, string BookingStatus)

but when call it , I get

Operation 'UpdateEncounterStatus' in contract 'IPMA' has a path variable named 'BookingID' which does not have type 'string'. Variables for UriTemplate path segments must have type 'string'.

and when change the parameter to string I got

method not allowed any idea how to fix that

AMH
  • 6,363
  • 27
  • 84
  • 135
  • How are you making the call? If you're typing that url into a browser you are doing a GET request, and your method is attributed to only match on a POST request. – magritte Jun 13 '12 at 09:07

1 Answers1

2

You can use only string types for the parameters that comes in the route of UriTemplate. In your example BookingID is integer and it comes in the route so it won't work. If you move BookingID to querystring them things will work.

See this thread for more details.

Community
  • 1
  • 1
VJAI
  • 32,167
  • 23
  • 102
  • 164