AMH
AMH

Reputation: 6451

WCF crash unexpectedly ,method not allowed

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

Upvotes: 0

Views: 1347

Answers (1)

VJAI
VJAI

Reputation: 32758

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.

Upvotes: 2

Related Questions