解析云代码中的SOAP请求 [英] SOAP request in parse cloud code
本文介绍了解析云代码中的SOAP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在解析云代码中发出SOAP请求.然后,我将返回的数据保存到解析类.我是javascript新手.我尝试使用Parse.Cloud.httpRequest来执行此操作,但是它不起作用.
I need to make a SOAP request in parse cloud code. Then I save returned data to a parse class. I am new at javascript. I tried to do it with Parse.Cloud.httpRequest but it did not work.
这是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\""
});
}
推荐答案
我根据以下问题解决了该问题:
I solved the problem according to the question :
在这里:
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);
});
});
这篇关于解析云代码中的SOAP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文