|
Inicio → WINDEV 25 → WX e WM - Lendo um retorno XML de um Webservice no Android e no iOS e arquivando os registros num array |
WX e WM - Lendo um retorno XML de um Webservice no Android e no iOS e arquivando os registros num array |
Iniciado por Boller, abr., 14 2015 4:23 PM - 1 resposta |
| |
| | | |
|
| |
Membro registado 4.520 mensagems |
|
Publicado em abril, 14 2015 - 4:23 PM |
Procedure WS_Taxi_Disponivel_New(LOCAL DebugSN)
ok, bRet is boolean = False
nRetornoCodigo is int = 0
nContador is int = 0
sCodClienteCelula is string = ""
XML_Retorno is string = ""
LocSt_TaxisLogados is ST_TaxisLogados
XML_Retorno = ws_mobile_consultar_posicoes_taxis(2912,9949,"SELECT")
IF DebugSN = "S" THEN fSaveText("c:\posicao.txt",XML_Retorno) END
XML_Retorno = WS_RemoveAcentos(XML_Retorno)
ok = False
IF Length(XML_Retorno) > 0 THEN
ArrayDeleteAll(arr_TaxisLogados)
IF IniOSMode() = True THEN
NoXml is string
i is int = 1
LOOP
NoXml = XMLExtractString(XML_Retorno,"NoXml",i)
IF NoXml = "" THEN BREAK END
LocSt_TaxisLogados.ST_ID = XMLExtractString(NoXml,"num_unidad") LocSt_TaxisLogados.ST_Latitude = XMLExtractString(NoXml,"val_latitu",1) LocSt_TaxisLogados.ST_Longitude = XMLExtractString(NoXml,"val_longit",1) LocSt_TaxisLogados.ST_Situacao = XMLExtractString(NoXml,"ide_priori_cadast",1)
arr_TaxisLogados[LocSt_TaxisLogados.ST_ID] = LocSt_TaxisLogados
nContador ++
i++
ok = True
END
ELSE IF InAndroidMode() = True
XmlDoc is XMLDocument
XmlDoc = XMLOpen(XML_Retorno, fromString)
NoXml is xmlNode
FOR EACH NoXml OF XmlDoc.Xml.Retorno on NoXml
IF NoXml.num_unidad <> Null AND NoXml.val_latitu <> Null AND NoXml.val_longit <> Null THEN
ok = True
nContador += 1
LocSt_TaxisLogados.ST_ID = NoXml.num_unidad LocSt_TaxisLogados.ST_Latitude = NoXml.val_latitu LocSt_TaxisLogados.ST_Longitude = NoXml.val_longit LocSt_TaxisLogados.ST_Situacao = NoXml.ide_priori_cadast
arr_TaxisLogados[LocSt_TaxisLogados.ST_ID] = LocSt_TaxisLogados
END
END
END
END
IF DebugSN = "S" THEN Info("Qtde de Taxis Disponiveis:",nContador) END
RESULT(ok) |
| |
| |
| | | |
|
| | |
| |
Membro registado 11 mensagems |
|
Publicado em abril, 14 2015 - 6:09 PM |
Muito bem documentada. Excelente! Parabens! |
| |
| |
| | | |
|
| | | | |
| | |
|