나는 아이폰 애플리케이션을 WCF 서비스와 통신하기 위해 애 쓰고있다. 내 응용 프로그램이 성공적으로 웹 서비스를 연결/찾지 만 오류가 아닌 응답을 반환하지 않습니다. 비주얼 스튜디오 wcf tester를 사용하면 잘 작동합니다.아이폰에서 WCF 서비스로
XML 형식 : 내 머리/몸을 구조화하고있어 방법에 문제가 <mAccess><user></user><pwd></pwd></mAccess>
있습니까?
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:website]];
[request setHTTPMethod:@"POST"];
[request setValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-type"];
NSString *soapMessage = [[NSString alloc] initWithFormat:@"<SOAP-ENV:Envelope
xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body>
<MobileAccess xmlns=\"http://tempuri.org/\"><mAccess><user>user</user><pwd>pwd</pwd><custID>0</custID></mAccess>
</MobileAccess></SOAP-ENV:Body></SOAP-ENV:Envelope>"];
[request setValue:[NSString stringWithFormat:@"%d",[soapMessage length]] forHTTPHeaderField:@"Content-length"];
[request addValue:@"http://tempuri.org/IProviderDataService/MobileAccess" forHTTPHeaderField:@"Soapaction"];
[request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
당신이 WCF에서/얻을 오류가 무엇입니까? – Jeroen
어떤 NSURLConnection 메서드를 사용합니까? 어떤 응답이나 오류 메시지가 나타 납니까? –
오류는 내부 서비스 오류입니다.이 메서드는 POST입니다. – Max