PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → web services
web services
Débuté par FRANKLIN SALINAS ( S, 03 jan. 2012 01:28 - 4 réponses
Membre enregistré
4 messages
Posté le 03 janvier 2012 - 01:28
Hi I wrote a simple “hello world” web service with windev 14 and Works fine.
Now I try to get an small data set from that web service with the serialize an deserialize functions but gives me this error “Format of binary information is incorrect” when I try do deserialize .
Thank you in advance for the help with this!!!!!!!!
Membre enregistré
105 messages
Posté le 11 septembre 2013 - 21:56
Were you able to get this to work? I'm running into the exact same error trying to deserialize some data from a webservice.
Posté le 12 septembre 2013 - 14:37
Hi

not sure the problem is coming from this, but remember that in android,
at least, all string are by default in unicode. It may just be that the
webservice is sending ansi back

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


On 9/11/2013 1:56 PM, rob wrote:
Were you able to get this to work? I'm running into the exact same error
trying to deserialize some data from a webservice.
Membre enregistré
105 messages
Posté le 12 septembre 2013 - 16:19
I wish it were that simple. This makes the 5th day I've been fighting with this. And really all I'm trying to do is return 4 variables from the web service.

I've sending it as an array, a structure, a queue, a serialized buffer, a serialized ANSI string (Serialize won't let you put it to a UNICODE string)

So far no dice, but I'm not giving up yet...
Membre enregistré
3 651 messages
Popularité : +175 (223 votes)
Posté le 14 mai 2014 - 18:31
PROCEDURE WS_ConsultarPosicaoTaxi(LOCAL NumCorrida, LOCAL TaxiIndice, LOCAL DebugSN)

//DebugSN = "S"

ChangeCharset(charsetOccidental) // SEM ACENTO

CodClienteCelula, nRetornoCodigo is int = 0
XML_Retorno, NumProces, VerificaLatitude is string = ""

IF NumCorrida > 0 THEN

//Variaveis de retorno
GloTaxiLatitude = ""
GloTaxiLongitude = ""

//Busca Cliente
HReadSeekFirst(t090_cliente_celular,t090_cliente_celular.A090_seq_cliente,1)
IF HFound(t090_cliente_celular) = True THEN


//NumProcess
NumProces = WS_ValidaRequisicao(t090_cliente_celular.A090_ddd_telefone,...
t090_cliente_celular.A090_num_telefone,...
0,...
0,...
"N")


//Envio
IF CodClienteCelula = "" OR CodClienteCelula = 0 THEN
CodClienteCelula = t090_cliente_celular.A090_cod_clientecelula
END

//Envelope
Xml_SEND is string = [
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi">
<soapenv:Header/>
<soapenv:Body>
<urn:ConsultarPosicaoTaxi soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<cod_client_celula xsi:type="xsd:int">v001</cod_client_celula>
<num_corrid xsi:type="xsd:int">v002</num_corrid>
<dat_hora_proces xsi:type="xsd:string">v003</dat_hora_proces>
<num_proces xsi:type="xsd:int">v004</num_proces>
</urn:ConsultarPosicaoTaxi>
</soapenv:Body>
</soapenv:Envelope>
]


//Replace
Xml_SEND = Replace(Xml_SEND,"v001",CodClienteCelula,IgnoreCase)
Xml_SEND = Replace(Xml_SEND,"v002",NumCorrida,IgnoreCase)
Xml_SEND = Replace(Xml_SEND,"v003",GloDataHora,IgnoreCase)
Xml_SEND = Replace(Xml_SEND,"v004",NumProces,IgnoreCase)

//info(NumProces)
//info(Xml_SEND)

Xml_Header is string = [
SOAPAction: "urn:act297_RtPlusSSDM-IRtPlusSSDM#ConsultarPosicaoTaxi"
]

Tamanho is int = Length(Xml_SEND)

Xml_Header = Replace(Xml_Header,"TamanhoString",Tamanho)

IF DebugSN = "S" THEN
IF InSimulatorMode() = False
fSaveBuffer("/mnt/sdcard/EnvioFV.TXT", Xml_SEND)
ELSE
fSaveBuffer("c:\EnvioFV.TXT", Xml_SEND)
END
Info(Xml_SEND)
END

HTTPTimeOut(GloTimeOut)

//BASE REAL
ok = HTTPRequest("http://177.124.60.220:8085/soap/IRtPlusSSDM","", "", Xml_SEND, "text/xml","","")

//BASE REAL
//ok = HTTPRequest("http://177.124.60.220:8086/soap/IRtPlusSSDM","", "", Xml_SEND, "text/xml","","")

IF ok = True

XML_Retorno = HTTPGetResult(httpResult)

XML_Retorno = WS_RemoveAcentos(XML_Retorno)

IF DebugSN = "S" THEN
IF InSimulatorMode() = False
fSaveBuffer("/mnt/sdcard/RetornoFV.TXT", XML_Retorno)
ELSE
fSaveBuffer("c:\RetornoFV.TXT", XML_Retorno)
END
END


//<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
//xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
//xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
//<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
//xmlns:NS1="urn:act297_RtPlusSSDM-IRtPlusSSDM">
//<NS1:ConsultarPosicaoTaxiResponse xmlns:NS2="urn:act297_RtPlusSSDM">
//<NS2:TPosicaoTaxi id="1" xsi:type="NS2:TPosicaoTaxi">
//<numCorrid xsi:type="xsd:long">2013</numCorrid>
//<ValLatitu xsi:type="xsd:double">-25.449987</ValLatitu>
//<ValLongit xsi:type="xsd:double">-49.1870234</ValLongit>
//<DesMensag xsi:type="xsd:string">Posição em 16/08/2013 18:03:10</DesMensag>
//</NS2:TPosicaoTaxi>
//<return href="#1"/>
//</NS1:ConsultarPosicaoTaxiResponse>
//</SOAP-ENV:Body>
//</SOAP-ENV:Envelope>


//Pegar o retorno
VerificaLatitude = WS_Busca_GeoTaxiLatitude(XML_Retorno)
IF VerificaLatitude <> 0 AND VerificaLatitude <> Null AND VerificaLatitude <> "" AND Middle(VerificaLatitude,1,5) <> "-0.00" AND Middle(VerificaLatitude,1,5) <> "0.000" THEN
GloTaxiLatitude = WS_Busca_GeoTaxiLatitude(XML_Retorno)
GloTaxiLongitude = WS_Busca_GeoTaxiLongitude(XML_Retorno)
GloGeoTaxiMensagem = WS_Busca_GeoTaxiMensagem(XML_Retorno)
ok = True
IF DebugSN = "S" THEN
Info(GloTaxiLatitude,GloTaxiLongitude)
END
END

IF GloTaxiLatitude <> "" AND GloTaxiLongitude <> "" THEN

IF gnQtdeTaxis = 1 AND TaxiIndice = 1
GloTaxiLatitude01 = GloTaxiLatitude
GloTaxiLongitude01 = GloTaxiLongitude
ELSE IF gnQtdeTaxis = 2 AND TaxiIndice = 2
GloTaxiLatitude02 = GloTaxiLatitude
GloTaxiLongitude02 = GloTaxiLongitude
ELSE IF gnQtdeTaxis = 3 AND TaxiIndice = 3
GloTaxiLatitude03 = GloTaxiLatitude
GloTaxiLongitude03 = GloTaxiLongitude
ELSE IF gnQtdeTaxis = 4 AND TaxiIndice = 4
GloTaxiLatitude04 = GloTaxiLatitude
GloTaxiLongitude04 = GloTaxiLongitude
ELSE IF gnQtdeTaxis = 5 AND TaxiIndice = 5
GloTaxiLatitude05 = GloTaxiLatitude
GloTaxiLongitude05 = GloTaxiLongitude
ELSE IF gnQtdeTaxis = 6 AND TaxiIndice = 6
GloTaxiLatitude06 = GloTaxiLatitude
GloTaxiLongitude06 = GloTaxiLongitude
END

ok = True

ELSE
ok = False
gloUmaVezConsultaCorrida = 0 //volta a consultar corrida
END

IF DebugSN = "S" THEN
NextTitle("Atenção")
Info("Posicao Taxi:",XML_Retorno)
END


END

ELSE
NextTitle("Aviso:")
Info("Erro: Faltou parametros ou dados não encontrados.",ErrorInfo(),ErrorOccurred)
END

END

RESULT(ok)