I have got solution for authentication to share point web service I have use fedAuth Cookie and rtfa Cookie to pass credential

Fisrt I have load the login page in webview and to load login page of sharepoint

When user done with login i will store those Cookie with following method

func verifyCookies()
{ var status = 0
var cookieArray:NSArray = storage.cookies! for cookie in cookieArray
{
if cookie.name == "FedAuth"
{
fedAuthCookie = cookie as NSHTTPCookie
status++
continue;
}
else if cookie.name == "rtFa"
{
status++
rtFaCookie = cookie as NSHTTPCookie
}
} if status == 2
{
self.webView.hidden = true
self.cookieFound(rtFaCookie,fedAuthCookie: fedAuthCookie) // method mention below.
} }

fedAuthCookie and rtFaCookie are variable name which store that cookie

And after that I have use those cookie to pass credential to my request.

Below is my request code

func cookieFound(rtFaCookie:NSHTTPCookie,fedAuthCookie:NSHTTPCookie)
{
var message:String = "<?xml version='1.0' encoding='utf-8'?><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/'><soap:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'><listName>demo</listName><viewName></viewName><query></query><viewFields></viewFields><rowLimit></rowLimit><QueryOptions></QueryOptions><webID></webID></GetListItems></soap:Body></soap:Envelope>" var messageLength = String(countElements(message))
var url = NSURL(string: "https://domain/_vti_bin/Lists.asmx")
var therequest = NSMutableURLRequest(URL: url!) therequest.addValue(messageLength, forHTTPHeaderField: "Content-Length")
therequest.addValue("text/xml; charset=utf-8", forHTTPHeaderField: "Content-Type")
therequest.addValue("http://schemas.microsoft.com/sharepoint/soap/GetListItems", forHTTPHeaderField: "SOAPAction") // Authentication is passed in request header var cookieArray = NSArray(objects: rtFaCookie,fedAuthCookie)
var cookieHeaders = NSHTTPCookie.requestHeaderFieldsWithCookies(cookieArray)
var requestHeaders = NSDictionary(dictionary: cookieHeaders) therequest.allHTTPHeaderFields = requestHeaders
therequest.HTTPMethod = "POST"
therequest.HTTPBody = message.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
var connection = NSURLConnection(request: therequest, delegate: self, startImmediately: true)
connection?.start() }

I have called verifyCookies() method from below webView methods

func webViewDidStartLoad(webView: UIWebView) {
self.verifyCookies()
}
func webViewDidFinishLoad(webView: UIWebView) {
self.verifyCookies()
}

Hope it will help someone

sharepoint services的更多相关文章

  1. Error message when you try to modify or to delete an alternate access mapping in Windows SharePoint Services 3.0: "An update conflict has occurred, and you must re-try this action"

    Article ID: 939308 - View products that this article applies to. Expand all | Collapse all Symptoms ...

  2. SharePoint Services 数据库表

    转:http://dugan.bokee.com/630446.html 以下是Microsoft Windows SharePoint Services架构中数据库列表. Configuration ...

  3. Windows SharePoint Services 3.0编码开发工具和技巧(Part 1 of 2)

    转:http://blog.csdn.net/mattwin/article/details/2074984 WSSv3 Technical Articles_Windows SharePoint S ...

  4. Windows SharePoint Services 默认母版页

    转:http://msdn.microsoft.com/zh-cn/library/ms467402(v=office.12).aspx 最终用户可以自定义的 Windows SharePoint S ...

  5. Microsoft Windows Sharepoint Services V3.0 安装图示

    本文以图示的方式,向读者展示Microsoft Windows SharePoint Services V3.0的安装过程. 在以下图示的安装过程中,使用了下面所列出的软件: Windows Serv ...

  6. 错误:当你使用id作为sharepoint的自定义页面的查询参数时,总会提示项目不存在!

    No item exists at http://SERVER/SITE/mypage.aspx?ID=1. It may have been deleted or renamed by anothe ...

  7. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q144-Q146)

    Question  144 You are planning a feature upgrade for a SharePoint 2010 farm. The original feature wi ...

  8. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q147-Q150)

    Question 147You have a Web application named WebApp1.You have a Feature receiver named FeatureReceiv ...

  9. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q142-Q143)

    Question 142You have a Feature that contains an image named ImageV1.png.You plan to create a new ver ...

随机推荐

  1. ubuntu11.04 编译ffmpeg2.7 并生成 ffplay进行流媒体測试

    源代码安装方式: 1. 先下载ffmpeg 安装包 到官网上 http://ffmpeg.org/download.html#releases 下载.选择Download gzip tarball. ...

  2. bootstrap 时间控件

    近期使用了bootstrap的UI感觉确实非常美丽,非常值得学习和使用. 以下先简单了解下bootstrap的时间控件. 这个时间控件使用起来还是很的简单.仅仅须要引入主要的css和js就能够了 须要 ...

  3. 获取Linux磁盘分区的UUID

    在设置fstab自动挂载时,需要填写如下的信息: # <file system> <mount point> <type> <options> < ...

  4. [办公自动化]名师推荐-excelpro刘万祥 图表之道作者

    最早认识刘万祥老师是通过孙小小老师的博客.后来发现制作图表,还真需要和PPT类似,花些时间琢磨一下. 首先你要了解图表的类型,然后需要了解制作方法,最后就是如何美化以及结合PPT等工具帮你分析数据. ...

  5. Python extensions for Windows

    Python extensions for Windows pywin32 214 Python extensions for Windows Maintainer: Mark Hammond Hom ...

  6. 获取浏览器弹窗alert、自定义弹窗以及其操作

    web自动化测试第10步:获取浏览器弹窗alert.自定义弹窗以及其操作 - CSDN博客 http://blog.csdn.net/ccggaag/article/details/76573857 ...

  7. hibernate 下载

    https://sourceforge.net/projects/hibernate/files/hibernate-orm/5.0.7.Final/ http://sourceforge.net/p ...

  8. clojure学习记录

    take 从列表中获取子列表 into a b  把b conj 到a中 (defn count-a-seq [lat]  (reduce (fn [x y] (+ x 1)) 0 lat)) red ...

  9. Linux ALSA声卡驱动之一:ALSA架构简介【转】

    本文转载自:http://blog.csdn.net/droidphone/article/details/6271122 声明:本博内容均由http://blog.csdn.net/droidpho ...

  10. [翻译]NUnit---Equality Asserts&& Identity Asserts (四)

    Equality Asserts 这些方法测试两个参数是否相等.语言不自动装修的普通类型可以使用对应的重载的方法. Comparing Numerics of Different Types 比较两个 ...