0
我有一个要求,可以从InfoPath表单上的重复表中提取数据并将其放入报表中。我在Codeplex上找到了一个解决方案文件,它将读取重复表中的数据,并通过SOAP查询将其输出为XML格式。我试图读取SOAP查询并通过CEWP中的JQuery将其输出到网页。我很努力地尝试这个方法,但我对如何解决这个问题有点遗憾。该Web服务提供了这个示例代码:阅读SharePoint 2010上的自定义Web服务
POST /_vti_bin/InfoPathDB/InfoPathDB.asmx HTTP/1.1
Host: 10.158.2.5
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<QueryFormLibrary xmlns="http://infopathdb.codeplex.com/">
<SiteURL>string</SiteURL>
<FormLibraryTitle>string</FormLibraryTitle>
<OptionalContentType>string</OptionalContentType>
<OptionalCAMLFilter>string</OptionalCAMLFilter>
<OptionalBooleanIncludeAttachments>string</OptionalBooleanIncludeAttachments>
</QueryFormLibrary>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<QueryFormLibraryResponse xmlns="http://infopathdb.codeplex.com/">
<QueryFormLibraryResult>xml</QueryFormLibraryResult>
</QueryFormLibraryResponse>
</soap12:Body>
</soap12:Envelope>
我有点困惑哪些部分需要去哪里在我的JQuery代码。我试图适应这个代码块是:
<script src="/Site_Assets/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var soapEnv =
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<QueryFormLibrary xmlns="http://infopathdb.codeplex.com/">
<SiteURL>http://255.255.255.1</SiteURL>
<FormLibraryTitle>List Entries</FormLibraryTitle>
<OptionalContentType></OptionalContentType>
<OptionalCAMLFilter></OptionalCAMLFilter>
<OptionalBooleanIncludeAttachments></OptionalBooleanIncludeAttachments>
</QueryFormLibrary>
</soap12:Body>
</soap12:Envelope>";
$.ajax({
url: "/_vti_bin/InfoPathDB/InfoPathDB.asmx HTTP/1.1",
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() {
var iDesc=$(this).attr("FieldOne");
var iResp=$(this).attr("FieldTwo");
var iID=$(this).attr("ows_ID");
var liHtml = "<div class='question' id='"+iID+"'>" + iDesc + "</div><div class='answer' id='a"+iID+"'>"+ iResp +"</a></div>";
$("#entries").append(liHtml);
}</script>
<div id="entries"> </div>
任何指针我做错了/对吗?