Vibhooti
Vibhooti

Reputation: 1203

NSMutableURLRequest handle special characters in soap request

The request(NSMutableURLRequest handle special characters in soap request) is not sent on server when we put logs in server. When i call webservice, server is not getting the reqest which i place it from my device. please help me if you have idea.

Upvotes: 0

Views: 425

Answers (2)

Hussain Shabbir
Hussain Shabbir

Reputation: 15025

Did you try this for making mutableurlrequest safe characters:-

NSString method stringByAddingPercentEscapesUsingEncoding:

Upvotes: 0

βhargavḯ
βhargavḯ

Reputation: 9836

All special chars will go in soap request except < > and &. So you need to do some work around for them.

You need to replace them like following at iOS end.

-(NSString*)replaceSpecialCharsFromString:(NSString*)str
{
    str = [str stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"];
    str = [str stringByReplacingOccurrencesOfString:@"<" withString:@"&lt;"];
    str = [str stringByReplacingOccurrencesOfString:@">" withString:@"&gt;"];

    return str;
}

Now when you receive this response at portal, at that moment you should have code to replace & to &, < to < , > to > in your store procedure before you insert in portal database.

Upvotes: 1

Related Questions