다음 코드를 사용해 보겠습니다. 비누 웹 서비스입니다. 작동하지 않습니다.비누 웹 서비스가 iphone에서 작동하지 않습니다.
나를 도와주세요.
ServiceNSString *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"
"<request xmlns=\"http://searchupc.com/GenerateBarcode\">\n"
"<auth>5ggpf54TRghbnIvqS2XVGQQ0q6qCNuJ</auth>\n"
"<method>FetchProductByUPC</method>"
"<params>"
"<upc>026274920257</upc>"
"</params>"
"</request>\n"
"</soap:Body>\n"
"</soap:Envelope>\n"
];
NSLog(soapMessage);
NSURL *url = [NSURL URLWithString:@"http://www.simpleupc.com/api/"];
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://searchupc.com/GenerateBarcode/" forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"SOAP CONNECTED qqq%@",theRequest);
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
WSDL에서 XSD를 가져 오는 경우 생성 된 코드가 작동하지 않는다는 경고가 표시됩니다. 적어도 1 년 전쯤에이 문제가 해결되었는지는 확실하지 않습니다. – bennythemink
@bennythemink : 저는 현재 프로젝트에서 이것을 사용하고 있으며 지금까지 아무런 문제가 없었습니다. 나는 그들이 언급 한 문제를 고쳤고 지적 해 주셔서 고맙다고 생각합니다. – aToz