开发者

How to send attatchments through webservice using iphone sdk?

开发者 https://www.devze.com 2023-04-10 04:38 出处:网络
In My application i have to send a file(audio,image,text and vedio etc..) to server using webservice.

In My application i have to send a file(audio,image,text and vedio etc..) to server using webservice. Here i am sending bytes to application using base64binary string. But here data is corrupted. Is there any way to sending base64binary to service.

Or is there any way to send attachments to service or copy the file into server.

Please any one can help me.

Thanks in advance.

-(NSMutableURLRequest *) SaveAttachments:(NSData *)data name:(NSString *)name fileType:(NSString *)type {

[self setUserCredentials];

NSString *strsdf = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSString *sdf=@"lll.jpg";
NSString *strt 开发者_如何学运维= [Base64 encode:data];
//NSLog(@"strt %@",strt);

NSString *soapMsg = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\
                     <soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\
                     <soap12:Body>\
                     <InsertAttachmentint xmlns=\"http://tempuri.org/\">\
                     <Filename>%@</Filename>\
                     <FileType>%@</FileType>\
                     <FileContentint>%@</FileContentint>\
                     </InsertAttachmentint>\
                     </soap12:Body>\
                     </soap12:Envelope>",sdf,type,strsdf];

This is the code. Here strsdf is binary


I would take a loot at http://allseeing-i.com/ASIHTTPRequest/

This wrapper makes it MUCH easier to send and receive data with iOS.

0

精彩评论

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

关注公众号