2014-05-21 08:28:06 8 Comments
How to call a WCF wsHttpBinding reliable-session enabled web service from iOS objective-C code.. I Wrote a general code for accessing the service, but I am getting this error "The action http://tempuri.org/MyService/AuthneticateUser is not supported by this endpoint. Only WS-ReliableMessaging February 2005 messages are processed by this endpoint".
Here my code
<NSString *[email protected]"<s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\">
<s:Header>
<a:Action s:mustUnderstand=\"1\">tempuri.org/MyService/AuthneticateUser
</… xmlns:h=\"tempuri.org\">1</h:ApplicationID>
<h:DeviceID xmlns:h=\"tempuri.org\">1</h:DeviceID>
<h:Password xmlns:h=\"tempuri.org\">Password1</h:Password>
<a:MessageID>urn:uuid:041b65a7-4ab2-4da9-ba3b-05d5cccfe074</a:MessageID>
<a:ReplyTo><a:Address>w3.org/2005/08/addressing/anonymous</a:Address>
</… s:mustUnderstand=\"1\">MySvcUrl
</a:To>
</s:Header>
<s:Body />
</s:Envelope>";
NSURL *url = [NSURL URLWithString: MySvcUrl];
NSMutableURLRequest *theRequest = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:0];
[theRequest setCachePolicy:NSURLCacheStorageNotAllowed];
NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[stringAuthenticateUsr length]];
[theRequest addValue: @"application/soap+xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: @"http://tempuri.org/MyService/AuthneticateUser" forHTTPHeaderField:@"Soapaction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPShouldHandleCookies:YES];
[theRequest setHTTPBody: [stringAuthenticateUsr dataUsingEncoding:NSUTF8StringEncoding]];
NSHTTPURLResponse* response; NSError* error = nil; NSData* resultData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:&response error:&error]; NSString *result = [[NSString alloc]initWithData:resultData encoding:NSUTF8StringEncoding]; NSLog(@"result--%@",result);
Related Questions
Sponsored Content
43 Answered Questions
[SOLVED] Passing Data between View Controllers
- 2011-03-06 12:43:57
- Matt Price
- 438371 View
- 1342 Score
- 43 Answer
- Tags: ios objective-c swift model-view-controller uiviewcontroller
26 Answered Questions
[SOLVED] What's the difference between the atomic and nonatomic attributes?
- 2009-02-26 02:31:34
- Alex Wayne
- 474389 View
- 1833 Score
- 26 Answer
- Tags: ios objective-c properties atomic nonatomic
13 Answered Questions
6 Answered Questions
5 Answered Questions
[SOLVED] What are the differences between WCF and ASMX web services?
- 2010-03-15 15:52:27
- shailesh
- 338824 View
- 373 Score
- 5 Answer
- Tags: wcf web-services asmx
2 Answered Questions
2 Answered Questions
[SOLVED] WCF (Silverlight) Duplex - Not hitting server
- 2010-03-04 15:42:10
- Tristan
- 1543 View
- 2 Score
- 2 Answer
- Tags: c# wcf silverlight duplex pollingduplexhttpbinding
0 comments