从ios发送肥皂web服务的参数

我正在使用SOAP服务从服务器获取数据到我的iOS应用程序。 现在我需要从应用程序上传一些数据到server.how我可以从SOAP消息。 这是我的SOAP服务。

POST /NoteService.asmx HTTP/1.1 Host: ios.myurl.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://www.myurl.com/CreateNoteUsingXMl" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <CreateNoteUsingXMl xmlns="http://www.myurl.com"> <AccountID>string</AccountID> <Username>string</Username> <Mypass>string</Mypass> <NoteXML>string</NoteXML> <isSign>int</isSign> <noteID>long</noteID> </CreateNoteUsingXMl> </soap:Body> </soap:Envelope> 

我怎么能通过accountid,用户名等在POST参数。

这很容易创build一个NSString

 NSString *soapMessage = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soap:Body>\n" "<CreateNoteUsingXMl xmlns="http://www.myurl.com">\n" " <Username>%@</Username>\n" "<Mypass>%@</Mypass>\n" "<NoteXML>%@</NoteXML>\n" "</CreateNoteUsingXMl>\n" "</soap:Body>\n" "</soap:Envelope>\n" ,username , mypassword , notexml ]; 

现在创buildNSURL

 NSURL *url = [NSURL URLWithString:@"What Ever"]; 

创buildNSMutableURLRequest

 NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]] 

做你想要的东西的其余部分…