剛開始讓我的腳溼與Web服務調用到SharePoint(2010)和像GetWebCollection
和GetListCollection
撥打電話是否正常工作,並返回預期的數據。運行GetListCollection
會按預期返回所有SP列表。Objective-C的調用Web服務的GetList在SharePoint 2010沒有返回數據
<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>
<GetListCollection xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
</soap:Body>
</soap:Envelope>
從SP名單回來後,我提取內部名稱爲日曆列表{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}
<_sList>
<InternalName>{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}</InternalName>
<Title>Calendar</Title>
…..
我的問題是當我嘗試做一個GetList
與該ID值作爲撥打:
NSString *soapFormat = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<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/\">\n"
"<soap:Body>\n"
"<GetList xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\" />\n"
"<listName>{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}</listName>\n"
"</GetList>\n"
"</soap:Body></soap:Envelope>\n"];
NSLog(@"Request is : %@",soapFormat);
NSURL *locationOfWebService = [NSURL URLWithString:@"http://192.168.0.114/_vti_bin/lists.asmx"];
NSLog(@"Web url = %@",locationOfWebService);
NSMutableURLRequest *theRequest = [[NSMutableURLRequest alloc]initWithURL:locationOfWebService];
NSString *msgLength = [NSString stringWithFormat:@"%d",[soapFormat length]];
[theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue:@"http://schemas.microsoft.com/sharepoint/soap/GetList"
forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
當我在iPad 5.1模擬器運行此,所述GetList
呼叫認證並進行連接,但返回0字節後面。
2013-01-05 13:31:56.053 SoapSharePoint[1936:c07] Request is : <?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>
<GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
<listName>{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}</listName>
</GetList>
</soap:Body></soap:Envelope>
2013-01-05 13:31:56.055 SoapSharePoint[1936:c07] Web url = http://192.168.0.114/_vti_bin/lists.asmx
2013-01-05 13:31:56.059 SoapSharePoint[1936:c07] Connected...
2013-01-05 13:31:56.136 SoapSharePoint[1936:c07] Received Auth Req.
2013-01-05 13:31:56.147 SoapSharePoint[1936:c07] Received 0 Bytes!
2013-01-05 13:31:56.147 SoapSharePoint[1936:c07]
使用招和另一個工作站上使用U2U CAML查詢生成器,我可以看到U2U產品發出GetListCollection
,GetAllSubWebCollections
當它(現在知道所有的網站和列表)啓動,當我在日曆上雙擊列表他們發送此SOAP
要求:
POST http://g2010/_vti_bin/lists.asmx HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.5466)
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/GetList"
Host: g2010
Content-Length: 378
Expect: 100-continue
Connection: Keep-Alive
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}</listName>
</GetList>
</soap:Body>
</soap:Envelope>
這將返回清單領域,並允許我建立一個CAML
查詢,然後返回在日曆列表中的2項。我不明白爲什麼我的電話GetList
沒有返回任何數據,並希望有人能夠發現我的明顯錯誤:-)
謝謝!