use of org.ksoap2.serialization.PropertyInfo in project SeaStar by 13120241790.
the class SoapManager method isArrayNode.
/**
* 判断该节点下面是否有相同的节点,如果说明是数组
* @param childsoap
* @return
*/
public boolean isArrayNode(SoapObject childsoap) {
PropertyInfo proinfo = null;
int count = childsoap.getPropertyCount();
for (int i = 0; i < count; i++) {
proinfo = new PropertyInfo();
childsoap.getPropertyInfo(i, proinfo);
if (SoapObject.class == proinfo.getType()) {
if (childsoap.hasProperty(proinfo.getName())) {
return true;
}
}
}
return false;
}
use of org.ksoap2.serialization.PropertyInfo in project SeaStar by 13120241790.
the class SoapManager method getSoapresult.
/**
* 将SoapObject转json字符串
* @param soapresult SoapObject
* @param jsonResult JSONObject
*/
private void getSoapresult(SoapObject soapresult, JSONObject jsonResult, HashSet<String> hashset) {
try {
if (soapresult != null) {
PropertyInfo proinfo = null;
SoapObject childsoap = null;
JSONObject childJson = null;
String curName = null;
int count = soapresult.getPropertyCount();
for (int i = 0; i < count; i++) {
//获取当前节点的信息
proinfo = new PropertyInfo();
soapresult.getPropertyInfo(i, proinfo);
curName = proinfo.getName();
//判断当前节点的类型,如果是SoapPrimitive则可以直接取值,如果是SoapObject则继续解析
if (SoapPrimitive.class == proinfo.getType()) {
jsonResult.put(curName, proinfo.getValue());
} else if (SoapObject.class == proinfo.getType()) {
childJson = new JSONObject();
childsoap = (SoapObject) soapresult.getProperty(i);
//判断该节点下面有相同节点,那么他就是一个数组
if (isArrayNode(childsoap)) {
hashset.add(curName);
NLog.e(tag, "curName : " + curName);
}
//处理相同名字的节点,到时候好替换成JSONArray
if (jsonResult.has(curName)) {
curName = curName + i;
}
//递归调用自己,获取子节点
getSoapresult(childsoap, childJson, hashset);
//将子节点添加到根节点下面
jsonResult.put(curName, childJson);
}
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
use of org.ksoap2.serialization.PropertyInfo in project ETSMobile-Android2 by ApplETS.
the class SignetsMobileSoap method donneesAuthentificationValides.
/**
* Retourne 'true' si le code d'acc��s universel et le mot de passe sont
* valides dans AD des ��tudiants
*/
public Boolean donneesAuthentificationValides(final String codeAccesUniversel, final String motPasse) throws Exception {
return (Boolean) execute(new IWcfMethod() {
@Override
public ExtendedSoapSerializationEnvelope CreateSoapEnvelope() {
ExtendedSoapSerializationEnvelope __envelope = createEnvelope();
SoapObject __soapReq = new SoapObject("http://etsmtl.ca/", "donneesAuthentificationValides");
__envelope.setOutputSoapObject(__soapReq);
PropertyInfo __info = null;
__info = new PropertyInfo();
__info.namespace = "http://etsmtl.ca/";
__info.name = "codeAccesUniversel";
__info.type = PropertyInfo.STRING_CLASS;
__info.setValue(codeAccesUniversel);
__soapReq.addProperty(__info);
__info = new PropertyInfo();
__info.namespace = "http://etsmtl.ca/";
__info.name = "motPasse";
__info.type = PropertyInfo.STRING_CLASS;
__info.setValue(motPasse);
__soapReq.addProperty(__info);
return __envelope;
}
@Override
public Object ProcessResult(ExtendedSoapSerializationEnvelope __envelope, SoapObject __result) throws Exception {
Object obj = __result.getProperty("donneesAuthentificationValidesResult");
if (obj != null && obj.getClass().equals(SoapPrimitive.class)) {
SoapPrimitive j = (SoapPrimitive) __result.getProperty("donneesAuthentificationValidesResult");
return new Boolean(j.toString());
}
return null;
}
}, "http://etsmtl.ca/donneesAuthentificationValides");
}
use of org.ksoap2.serialization.PropertyInfo in project ETSMobile-Android2 by ApplETS.
the class SignetsMobileSoap method listeCours.
/**
* Liste de tous les cours de l'��tudiant: sigle, groupe, session,
* programme, cote finale, nombre de cr��dits et titre du cours, tri��e par
* session et sigle.
*/
public ListeDeCours listeCours(final String codeAccesUniversel, final String motPasse) throws Exception {
return (ListeDeCours) execute(new IWcfMethod() {
@Override
public ExtendedSoapSerializationEnvelope CreateSoapEnvelope() {
ExtendedSoapSerializationEnvelope __envelope = createEnvelope();
SoapObject __soapReq = new SoapObject("http://etsmtl.ca/", "listeCours");
__envelope.setOutputSoapObject(__soapReq);
PropertyInfo __info = null;
__info = new PropertyInfo();
__info.namespace = "http://etsmtl.ca/";
__info.name = "codeAccesUniversel";
__info.type = PropertyInfo.STRING_CLASS;
__info.setValue(codeAccesUniversel);
__soapReq.addProperty(__info);
__info = new PropertyInfo();
__info.namespace = "http://etsmtl.ca/";
__info.name = "motPasse";
__info.type = PropertyInfo.STRING_CLASS;
__info.setValue(motPasse);
__soapReq.addProperty(__info);
return __envelope;
}
@Override
public Object ProcessResult(ExtendedSoapSerializationEnvelope __envelope, SoapObject __result) throws Exception {
return (ListeDeCours) getResult(ListeDeCours.class, __result, "listeCoursResult", __envelope);
}
}, "http://etsmtl.ca/listeCours");
}
use of org.ksoap2.serialization.PropertyInfo in project ETSMobile-Android2 by ApplETS.
the class SignetsMobileSoap method lireHoraire.
/**
* Liste des cours pour le trimestre et le sigle de cours partiel pass��s en
* param��tres. Tous les CTN1 �� l'hiver 2012, par exemple
*/
public listeCoursHoraire lireHoraire(final String pSession, final String prefixeSigleCours) throws Exception {
return (listeCoursHoraire) execute(new IWcfMethod() {
@Override
public ExtendedSoapSerializationEnvelope CreateSoapEnvelope() {
ExtendedSoapSerializationEnvelope __envelope = createEnvelope();
SoapObject __soapReq = new SoapObject("http://etsmtl.ca/", "lireHoraire");
__envelope.setOutputSoapObject(__soapReq);
PropertyInfo __info = null;
__info = new PropertyInfo();
__info.namespace = "http://etsmtl.ca/";
__info.name = "pSession";
__info.type = PropertyInfo.STRING_CLASS;
__info.setValue(pSession);
__soapReq.addProperty(__info);
__info = new PropertyInfo();
__info.namespace = "http://etsmtl.ca/";
__info.name = "prefixeSigleCours";
__info.type = PropertyInfo.STRING_CLASS;
__info.setValue(prefixeSigleCours);
__soapReq.addProperty(__info);
return __envelope;
}
@Override
public Object ProcessResult(ExtendedSoapSerializationEnvelope __envelope, SoapObject __result) throws Exception {
return (listeCoursHoraire) getResult(listeCoursHoraire.class, __result, "lireHoraireResult", __envelope);
}
}, "http://etsmtl.ca/lireHoraire");
}
Aggregations