웹 서비스를 사용하여 데이터를 삭제하려면 어떻게해야합니까?webservice iOS를 사용하여 데이터 삭제
나는 UILabel
을 uiOid
으로 표시하고 CustomTableviewCell.h
입니다. 이제 ViewController.m에서 uiOid
을 cell.uiOid.text=[orid objectAtIndex:indexPath.row];
으로 사용하고 있습니다. 여기 orid
은 웹 서비스에서 레코드를 검색하기 위해 NSMutablearray
입니다. 데이터를 올바르게 검색했지만 문제는 어떻게 삭제합니까? 웹 서비스를 사용하여 데이터를 삭제하고 있습니다.
나는
// 업데이트 //
- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
{
[desc removeObjectAtIndex:indexPath.row];
[item removeObjectAtIndex:indexPath.row];
[cpack removeObjectAtIndex:indexPath.row];
[uprice removeObjectAtIndex:indexPath.row];
[cprice removeObjectAtIndex:indexPath.row];
[quantity removeObjectAtIndex:indexPath.row];
[total removeObjectAtIndex:indexPath.row];
[orid removeObjectAtIndex:indexPath.row];
NSLog(@"%@",[uid objectForKey:@"OID"]);
NSLog(@"%@",orid);
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"
"<DeleteValue xmlns=\"http://tempuri.org/\">\n"
"<oid>%@</oid>"
"</DeleteValue>\n"
"</soap:Body>\n"
"</soap:Envelope>\n",orid
];
NSLog(@"%@",soapmessage);
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",appdev.hostname]];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapmessage length]];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: @"http://tempuri.org/DeleteVaue" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapmessage dataUsingEncoding:NSUTF8StringEncoding]];
}
[mytableview reloadData];
}
방법
에서 삭제 웹 서비스를 삽입했다. 정적 번호 "89291"을 입력하면 데이터가 성공적으로 삭제됩니다 (여러 작업에 유용하지 않음). 하지만 정적 번호 대신orid (NSMutableArray)
을 webservice에 전달하고 싶습니다. 이 문제를 어떻게 해결할 수 있습니까? 도움 주셔서 감사합니다. 당신의 삭제 서비스 방법에
배열을 보낼 수 있습니다. 그러나 그 웹 서비스를 위해서도 변경해야합니다. –
@HinataHyuga. WS –
을 변경할 준비가되었으므로 webservice에서 문자열을 전달할 때마다 배열을 사용하십시오. 그리고 webservice에서 해당 배열을 가져와 모든 항목을 삭제하십시오. –