开发者

HowTo: iPhone Web Service call to WCF Service with Certificate Authentication

We are a .Net shop currently developing a iPhone app that requires the app to call a WCF web service. Our WCF Services are secured with a x509 certificate for authentication purposes.

I have been searching the internet for an example on how to do the following:

  1. Deploy a certificate with an iPhone app.
  2. Use that certificate in a web service call to a WCF Service.

Any insight on how this might be accomplished would be greatly appreciate开发者_开发问答d.


One could use the NSURLConnection API in asynchronous mode. You'll need to implement an object with the NSURLConnectionDelegate protocol (http://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSURLConnectionDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSURLConnectionDelegate).

The delegate will get a call on the method connection:didReceiveAuthenticationChallenge: when the server challenges for a certificate.

See the Apple guide for the URL loading system (http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Articles/AuthenticationChallenges.html#//apple_ref/doc/uid/TP40009507-SW1)

For loading an SSL cert from the bundle see this StackOverflow answer:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜