Javascript 解析云代码中的SOAP请求

Javascript 解析云代码中的SOAP请求,javascript,soap,parse-platform,parse-cloud-code,Javascript,Soap,Parse Platform,Parse Cloud Code,我需要在解析云代码时发出SOAP请求。然后我将返回的数据保存到一个解析类中。我是javascript新手。我试着用Parse.Cloud.httpRequest来做,但没有成功 以下是SOAP请求: var elPlanliTable = $('#planliTable'); var filterPlanliKesintiler = true; function getAllPlanliKesintiler(){ var listName = "PlanliKesintiler";

我需要在解析云代码时发出SOAP请求。然后我将返回的数据保存到一个解析类中。我是javascript新手。我试着用Parse.Cloud.httpRequest来做,但没有成功

以下是SOAP请求:

var elPlanliTable = $('#planliTable');
var filterPlanliKesintiler = true;

function getAllPlanliKesintiler(){

    var listName = "PlanliKesintiler";

    var where = (filterPlanliKesintiler) ?
    "<And><Geq><FieldRef Name='Tarih' /><Value Type='DateTime'><Today OffsetDays='-30' /></Value></Geq><Eq><FieldRef Name='Aktif' /><Value Type='Boolean'>1</Value></Eq></And>" :
    "<Eq><FieldRef Name='Aktif' /><Value Type='Boolean'>1</Value></Eq>";

    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> \
    <query> \
    <Query> \
    <OrderBy> \
    <FieldRef Name='Tarih' Type='DateTime' IncludeTimeValue='FALSE' Ascending='False' /> \
    </OrderBy> \
    <Where> \
    " + where + " \
    </Where> \
    </Query> \
    </query> \
    <viewFields> \
    <ViewFields> \
    <FieldRef Name='Tarih' /> \
    <FieldRef Name='BaslangicSaat' /> \
    <FieldRef Name='BitisSaat' /> \
    <FieldRef Name='Planl_x0131__x0020_Kesinti_x0020' /> \
    <FieldRef Name='Bolgeler' /> \
    <FieldRef Name='KesintiNedeni' /> \
    <FieldRef Name='Aktif' /> \
    <FieldRef Name='AboneSayisi' /> \
    </ViewFields> \
    </viewFields> \
    <rowLimit>0</rowLimit> \
    </GetListItems> \
    </soapenv:Body> \
    </soapenv:Envelope>";


    var load = '<div class="spinner" style="position:absolute; width:100%; height:100%; background-color:rgba(255,255,255,.8); top:-100px;  "><h4 style="display:block; text-align:center; margin:28% auto;">Yükleniyor, Lütfen Bekleyiniz...<h4><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div><div class="rect5"></div></div>';
    elPlanliTable.html(load);

    var urlAdres = null;
    var culture = _spPageContextInfo.currentCultureName;


    $.ajax({
           url:"http://www.sedas.com/tr-tr/Bilgi_Danisma/_vti_bin/lists.asmx",
           type: "POST",
           dataType: "xml",
           data: soapEnv,
           complete: processPlanliKesintilerResult,
           contentType: "text/xml; charset=\"utf-8\""
           });

}
var elPlanliTable=$(“#planliTable”);
var FilterPlanlikesIndiler=true;
函数getAllPlanLikesIndiler(){
var listName=“PlanliKesintiler”;
变量where=(filterPlanliKesintiler)?
"1" :
"1";
var soapEnv=
" \
\
\
“+listName+”\
\
\
\
\
\
\
“+其中+”\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
0 \
\
\
";
var负荷=‘Yükleniyor,Lütfen Bekleyinazing…’;
elPlanliTable.html(加载);
var urlAdres=null;
var culture=\u spPageContextInfo.currentCultureName;
$.ajax({
url:“http://www.sedas.com/tr-tr/Bilgi_Danisma/_vti_bin/lists.asmx",
类型:“POST”,
数据类型:“xml”,
数据:soapEnv,
完成:ProcessPlanLikesIndilerResult,
contentType:“text/xml;字符集=\“utf-8”
});
}

我根据以下问题解决了问题:

这是:

Parse.Cloud.define("Uedas", function(request, response) {

                   var filterPlanliKesintiler = false;

                   var listName = "PlanliKesintiler";

                   var where = (filterPlanliKesintiler) ?
                   "<And><Geq><FieldRef Name='Tarih' /><Value Type='DateTime'><Today OffsetDays='-30' /></Value></Geq><Eq><FieldRef Name='Aktif' /><Value Type='Boolean'>1</Value></Eq></And>" :
                   "<Eq><FieldRef Name='Aktif' /><Value Type='Boolean'>1</Value></Eq>";

                   var Buffer = require('buffer').Buffer;

                   buffer = new Buffer(
                                       "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
                                       <soapenv:Body> \
                                       <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
                                       <listName>"+listName+"</listName> \
                                       <query> \
                                       <Query> \
                                       <OrderBy> \
                                       <FieldRef Name='Tarih' Type='DateTime' IncludeTimeValue='FALSE' Ascending='False' /> \
                                       </OrderBy> \
                                       <Where> \
                                       " + where + " \
                                       </Where> \
                                       </Query> \
                                       </query> \
                                       <viewFields> \
                                       <ViewFields> \
                                       <FieldRef Name='Tarih' /> \
                                       <FieldRef Name='BaslangicSaat' /> \
                                       <FieldRef Name='BitisSaat' /> \
                                       <FieldRef Name='Planl_x0131__x0020_Kesinti_x0020' /> \
                                       <FieldRef Name='Bolgeler' /> \
                                       <FieldRef Name='KesintiNedeni' /> \
                                       <FieldRef Name='Aktif' /> \
                                       <FieldRef Name='AboneSayisi' /> \
                                       </ViewFields> \
                                       </viewFields> \
                                       <rowLimit>0</rowLimit> \
                                       </GetListItems> \
                                       </soapenv:Body> \
                                       </soapenv:Envelope>"

                                       );



                   Parse.Cloud.httpRequest({
                                           method: 'POST',
                                           url: 'http://www.sedas.com/tr-tr/Bilgi_Danisma/_vti_bin/lists.asmx',
                                           headers: {
                                           'Content-Type': 'text/xml; charset=utf-8'
                                           },
                                           body: buffer
                                           }).then(function(httpResponse) {
                                                   // success
                                  response.success(httpResponse.text);

                                                   },function(httpResponse) {
                                                   // error
                                                   response.error(httpResponse.text);
                                                   });


                   });
Parse.Cloud.define(“Uedas”),函数(请求、响应){
var FilterPlanlikesIndiler=false;
var listName=“PlanliKesintiler”;
变量where=(filterPlanliKesintiler)?
"1" :
"1";
var Buffer=require('Buffer')。Buffer;
缓冲区=新缓冲区(
" \
\
\
“+listName+”\
\
\
\
\
\
\
“+其中+”\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
0 \
\
\
"
);
Parse.Cloud.httpRequest({
方法:“POST”,
网址:'http://www.sedas.com/tr-tr/Bilgi_Danisma/_vti_bin/lists.asmx',
标题:{
“内容类型”:“text/xml;charset=utf-8”
},
正文:缓冲区
}).then(函数(httpResponse){
//成功
响应成功(httpResponse.text);
},函数(httpResponse){
//错误
response.error(httpResponse.text);
});
});