小编Chr*_*rry的帖子

解析Web服务数据iOS

下午好,

我已经从Web服务下载数据并且我正在寻找解析数据以便我可以使用它,但是我在解析返回的值时遇到问题,下面是采集代码以及任何其他内容之间的任何帮助将被赞赏

 -(IBAction)runNewImport:(id)sender{


recordResults = FALSE;

soapMessage = [NSString stringWithFormat:

               @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

               "<s:Envelope \n"

               "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n"
               "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" 
               "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" \n"
               "s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" \n"
               "xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"> \n"       


               "<s:Body> \n"

               "<[FUNCTION] xmlns=\"http://tempuri.org/\"/>\n"

               "</s:Body> \n"
               "</s:Envelope>"];


[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSURL *url = [NSURL URLWithString:@"http://[PATH]"];      
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];             
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];          
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];       
[theRequest addValue: @"[FUNCTION]" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];     
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

if(theConnection) { …
Run Code Online (Sandbox Code Playgroud)

xml web-services objective-c nsxmlparser ios

2
推荐指数
1
解决办法
2832
查看次数

标签 统计

ios ×1

nsxmlparser ×1

objective-c ×1

web-services ×1

xml ×1