0
웹 서비스에서 응답을 받기위한 함수를 작성했습니다. 하지만 이제 매개 변수를 웹 서비스에 보내려고합니다. 다른 웹 서비스에 매개 변수를 보내려면 아래 코드를 어떻게 수정하면됩니까? 아래 코드로 작업하고 싶습니다. IOS에 익숙하지 않고 작업 코드가 있기 때문에 엉망이되고 싶지 않습니다.웹 서비스에 매개 변수 보내기
- (IBAction)buttonClick:(id)sender {
recordResults = FALSE;
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"
"<GetUserList xmlns=\"http://methodoor.com/checkupservice/\" />\n"
"</soap:Body>\n"
"</soap:Envelope>\n"];
//NSLog(soapMessage);
_lbl_result.text = soapMessage;
NSURL *url = [NSURL URLWithString:@"http://servicing2.rotanet.com.tr/service.asmx"];
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://methodoor.com/checkupservice/GetUserList" 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)
{
webData = [[NSMutableData data] retain];
}
else
{
NSLog(@"theConnection is NULL");
}
//[nameInput resignFirstResponder];
}
[이 링크] (http://methodoor.com/checkupservice/GetUserList)가 열리지 않습니까? GetUserList 메서드 및 매개 변수에 대한 wsdl 설명을 가져올 수 있습니까? –
글쎄, 나는 그것을하는 법을 배우기 만하고있다. 웹 서비스는 매개 변수가 필요 없다. 하지만 매개 변수에 대한 응답으로 웹 서비스를 수정합니다. 나는 그것을 어떻게하는지 알고 싶다. –