1

I am working in a WCF rest service part for IPhone application. One of my method is as follows.

[OperationContract]
        [WebInvoke(Method="POST",
                   ResponseFormat = WebMessageFormat.Json,
                   BodyStyle = WebMessageBodyStyle.Wrapped,
                   UriTemplate = "Update/{tokenId}/{title}")]
int Update (string tokenId, string title);

My problem is when we pass special characters in the “title” parameter , this method has not been calling. I think it is related to encoding. How can we implement encoding for this? If possible please provide the encode and decode code for both IPhone and WCF section. Thanks in advance.

Regfor
  • 8,515
  • 1
  • 38
  • 51
Ranish
  • 877
  • 2
  • 10
  • 30
  • I guess this might be helpfull : http://stackoverflow.com/a/3073377/1236044 – jbl Nov 26 '12 at 08:54
  • @Ranish, r you used RestKit Framework, bcoz I need to implement Rest api's with Post method. If you have done Please share some good links. – Ganesh G Apr 30 '13 at 12:43

1 Answers1

0

You need to use URL encoding/decoding for your parameters in URI.

For .NET part either use some custom deserializer mechanism (there are such in Web API, don't recall wether they was in WCF 4 REST) or:

Methods UrlEncode and UrlDecode from System.Web.HttpUtlity class

For iphone part look around here in questions, e.g. How do I URL encode a string

Community
  • 1
  • 1
Regfor
  • 8,515
  • 1
  • 38
  • 51