0

GetWebCollectionSharePoint(2010) への Web サービス呼び出しで足を濡らし始めたところGetListCollectionです。を実行するGetListCollectionと、期待どおりにすべての SP リストが返されます。

<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]

GetListCollectionFiddler を使用し、別のワークステーションで U2U CAML クエリ ビルダーを使用すると、起動時にU2U 製品が を発行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データを返さない理由がわかりません。誰かが私の明らかなエラーを見つけてくれることを望んでいました:-)

ありがとう!

4

1 に答える 1

1

この説明は少しやり過ぎかもしれませんが、不明確ではありません。タグGetListがコード ブロック内で途中で終了しています。

<GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/" />
    <listName>{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}</listName>
</GetList>

最初の GetList タグの最後の / は、GetListすぐに閉じられるようにします。書く<GetList />ことは書くことと同じ<GetList></GetList>です。したがって、コードブロックは次のように表示されます。

<GetList xmlns="http://schemas.microsoft.com/sharepoint/soap/" >
</GetList>
<listName>{A2CEBD3C-D07A-44A3-BE34-975AFE57F56C}</listName>
</GetList>

最初の 2 行はGetListlistName のないもので、3 行目は listName ですが、そのGetList周りにはもうありません。4 行目は何もしない「GetList の終了」タグです。

最初のタグから最後の/を削除すると、GetListすべてが機能するはずです:-)

于 2013-02-19T13:22:20.420 に答える