Я скромно прошу вашей помощи в этом вопросе, чтобы всегда получать 0 байтов
Вот результаты, с которыми я столкнулся:
TestWCFCalls[94830:f803] didReceiveResponse
2011-12-14 17:11:37.054 TestWCFCalls[94830:f803] connectionDidFinishLoading
2011-1214 17:11:37.055 TestWCFCalls[94830:f803] DONE. Received Bytes: 0
(IBAction) buttonClicked: (id) отправитель {
//Variables used
NSMutableData *webData;
NSString *soapMessage = NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap12:Envelope \n"
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n"
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n"
"xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\"> \n"
"<soap12:Body> \n"
"<MobileLogOn xmlns=\"http://tempuri.org/\"> \n"
"<userID>test</userID><PWD>test</PWD></MobileLogOn> \n"
"</soap12:Body> \n"
"</soap12:Envelope>"];
NSLog(soapMessage);
NSURL *url = [NSURL URLWithString:@"http://10.10.10.75:8731/Design_Time_Addresses/MobileWCFService.WCFServices/UserLogOnServ/"];
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/iUserLogOnServ/MobileLogOn" 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) {
NSLog(@"test");
webData = [[NSMutableData data] retain];
}
else {
NSLog(@"theConnection is NULL");
}
}
-Web Configuration-
<service behaviorConfiguration="MobileWCFService.WCFServices.MobileUserLogOnServBehavior"
name="MobileWCFService.WCFServices.MobileUserLogOnServ">
<endpoint address="" binding="wsHttpBinding" bindingName="MobileLogOnBinding"
contract="MobileWCFService.WCFServices.IMobileUserLogOnServ">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://10.10.10.75:8731/Design_Time_Addresses/MobileWCFService.WCFServices/MobileUserLogOnServ/" />
</baseAddresses>
</host>
</service>
Я не уверен, какую часть я пропустил, но я почти уверен, что пропустил какой-то пункт, хотя я могу позвонить в сервисную часть, но я не получил никаких данных.
Доброе спасибо,
Sel