开发者

Unable to PUT/POST to Prestashop Web Service in iOS

开发者 https://www.devze.com 2023-03-28 14:01 出处:网络
Im trying to POST and PUT to prestashop web service that has POST and PUT both enab开发者_开发知识库led but im unable to do it. GET works fine but not PUT/POST. Can anyone gimme a sample code snippet

Im trying to POST and PUT to prestashop web service that has POST and PUT both enab开发者_开发知识库led but im unable to do it. GET works fine but not PUT/POST. Can anyone gimme a sample code snippet or something as to how to make the HTTP request for PUT/POST? I've tried the normal http request setting the method to POST/PUT but of no use. Please help me out asap!!!

PS: Im trying to do this from iOS (iPhone)...


Hi you can try to use the following : http://allseeing-i.com/ASIHTTPRequest/

It is a very solid library.

They also have some examples:

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request appendPostData:[@"This is my data" dataUsingEncoding:NSUTF8StringEncoding]];
// Default becomes POST when you use appendPostData: / appendPostDataFromFile: / setPostBody:
[request setRequestMethod:@"PUT"];


I finally sorted out the problem on the server side of the web service. There was a bug in Prestashop version to whose web service I was trying to PUT/POST. The XML was being appended as a URL querystring but the escape characters to recognize the XML string was wrongly coded somewhere. Had to sit out with the PHP developer and sort it out. If anyone is facing the same problem, check out the Prestashop PHP code part of the web service and find out the escape character recognizing block and fix it (sorry i really dont know where the PHP guy fixed it, else would have given a better description).

0

精彩评论

暂无评论...
验证码 换一张
取 消