Bonjour,
J'ai mis en place un code Javascript basé sur l'API Jquery qui a pour but de récupérer le contenu d'une colonne d'un listItem en fonction d la valeur d'une autre colonne.
Mais ce dernier ne rempli pas mon champ et je n'arrive pas à trouver l'origine de mon problème. Après quelque tests, je pense que cela provient du xml que je fourni au webservice mais je n'arrive pas a identifier l'erreur.
Voici mon code :
[EDIT]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 <script type="text/javascript" src="/_layouts/jQueryInclude/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var soapEnv = "<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>MaListe</listName> \ <viewFields> \ <ViewFields> \ <FieldRef Name='Detail' /> \ </ViewFields> \ </viewFields> \ <queryOptions></queryOptions> \ <query> \ <Query> \ <Where> \ <Eq> \ <FieldRef Name='ItemId' /> \ <Value Type='Text'>"+$("select[title='AO']").val()+"</Value> \ </Eq> \ </Where> \ </Query> \ </query> \ </GetListItems> \ </soap:Body> \ </soap:Envelope>"; $.ajax({ url: "http://<url>/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapEnv, complete: processResult, contentType: "text/xml; charset=\"utf-8\"" }); }); function processResult(xData, status) { $(xData.responseXML).find("z\\:row").each(function() { $("textarea[title='Détail']").text($(this).attr("ows_Detail")); }); } </script>
Après avoir fait quelques tests et corrigé des erreurs (j'ai mis à jour mon code), j'ai une erreur 500 qui est retournée par le web service :
[/EDIT]
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 "<?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><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Une exception de type 'Microsoft.SharePoint.SoapServer.SoapServerException' a été levée.</faultstring><detail><errorstring xmlns="http://schemas.microsoft.com/sharepoint/soap/">Élément racine manquant.</errorstring></detail></soap:Fault></soap:Body></soap:Envelope>"
Je suis preneur de toutes vos suggestions.
Spaeda
Partager