Getting Data from a SOAP envelope

你。 提交于 2019-12-12 05:37:51

问题


I am trying to populate a gadget with a sharepoint list, but I couldn't find any way or tutorial on google to help me with this, however I find this tutorial that is getting the XML feedbacks of a news website, and displaying them in a list.

Tutorial for Making a Gadget that gets XML feedbacks off a news Site

Now Instead of getting XML feedback from that News Website, I want this tutorial to display items of XML document I will get throught this piece of code,

$(document).ready(function() 
{
    var soapEnv =
        "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> 
            <soapenv:Body> 
                 <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> 
                    <listName>ListName</listName> 
                    <viewFields> 
                        <ViewFields> 
                           <FieldRef Name='Title' /> 
                       </ViewFields> 
                    </viewFields> 
                </GetListItems> 
            </soapenv:Body> 
        </soapenv:Envelope>";

    $.ajax({
        url: "http://my_site/_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() {
        alert($(this).attr("ows_Title"));
    });
}

I got no clue about how can i do this trick, but please can you atleast just guide me, how can i accomplish this task, + what things should i look into or learn, as google is not helping me with my queries at all :/.


回答1:


Instead of using soap requests and query through /_vti_bin/lists.asmx good option is to use SPServices library, which is a simplest way to get data without digging into soap requests. there are many simple examples, try it out!

But, if it is compulsory to stick to soap implementation, there are two tools that can help you soapUI and fiddler.

with the help of soapUI, you will be able to create a soap request easily from url you have. You can inspect request and response using fiddler.

Let me know if you have more questions



来源:https://stackoverflow.com/questions/10636101/getting-data-from-a-soap-envelope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!