请求解析 xml 数据。
假设这是请求的方法-
-(无效)PostPipeSeaAam异常{
NSString *soapMsg =
[NSString stringWithFormat:
@"<?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>"
"<PostPipeSeAamAnomaly xmlns=\"http://tempuri.org/\">"
"<PDAIRID>%d</PDAIRID>n"
"<AssociatedItemIDILI>%@</AssociatedItemIDILI>n"
"<AssociatedItemIDOther>%@</AssociatedItemIDOther>n"
"<RGW>%@</RGW>n"
"<StartDistance>%@</StartDistance>n"
"<Length>%@</Length>n"
"<Width>%@</Width>n"
"<Orientation1>%@</Orientation1>n"
"<Orientation2>%@</Orientation2>n"
"<AnomalyType>%@</AnomalyType>n"
"<OrientationToWeld>%@</OrientationToWeld>n"
"<LongestLinearIndication>%@</LongestLinearIndication>n"
"<LocalWallThickness>%@</LocalWallThickness>n"
"<AnomalyDepthMinimum>%@</AnomalyDepthMinimum>n"
"<AnomalyDepthAverage>%@</AnomalyDepthAverage>n"
"<AnomalyDepthMaximum>%@</AnomalyDepthMaximum>n"
"<AnomalyDepthSurface>%@</AnomalyDepthSurface>n"
"<AnomalyDepthMaximumPercentage>AA</AnomalyDepthMaximumPercentage>n"
"<AnomalyDepthMinimumPercentage>AA</AnomalyDepthMinimumPercentage>n"
"<SizingMethod>%@</SizingMethod>n"
"<AnomalyRemoved>%@</AnomalyRemoved>n"
"<RemedialActionRequired>%@</RemedialActionRequired>n"
"<RemedialActionIncidental>%@</RemedialActionIncidental>n"
"<Comment>%@</Comment>n"
"</PostPipeSeAamAnomaly>n"
"</soap:Body>"
"</soap:Envelope>",PDAirID ,[arrPipeSeamAnomaly objectAtIndex:2] ,[arrPipeSeamAnomaly objectAtIndex:3],[arrPipeSeamAnomaly objectAtIndex:4] ,[arrPipeSeamAnomaly objectAtIndex:5] ,[arrPipeSeamAnomaly objectAtIndex:6],[arrPipeSeamAnomaly objectAtIndex:7] ,[arrPipeSeamAnomaly objectAtIndex:8] ,[arrPipeSeamAnomaly objectAtIndex:9],[arrPipeSeamAnomaly objectAtIndex:10],[arrPipeSeamAnomaly objectAtIndex:11] ,[arrPipeSeamAnomaly objectAtIndex:12] ,[arrPipeSeamAnomaly objectAtIndex:13],[arrPipeSeamAnomaly objectAtIndex:2] ,[arrPipeSeamAnomaly objectAtIndex:2],[arrPipeSeamAnomaly objectAtIndex:14] ,[arrPipeSeamAnomaly objectAtIndex:15],[arrPipeSeamAnomaly objectAtIndex:16] ,[arrPipeSeamAnomaly objectAtIndex:17],[arrPipeSeamAnomaly objectAtIndex:18],[arrPipeSeamAnomaly objectAtIndex:19] ,[arrPipeSeamAnomaly objectAtIndex:20]];
//NSLog(@"%@",soapMsg);
NSURL *url = [NSURL URLWithString:
WEBSERVICEURL];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
//---set the various headers---
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]];
[req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[req addValue:@"http://tempuri.org/PostPipeSeAamAnomaly" forHTTPHeaderField:@"SOAPAction"];
[req addValue:msgLength forHTTPHeaderField:@"Content-Length"];
//---set the HTTP method and body---
[req setHTTPMethod:@"POST"];
[req setHTTPBody:[soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
//[activityIndicator startAnimating];
conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];
if (conn) {
webData = [NSMutableData data];
//NSLog(@"go to delegateMethods");
}
}