JSON ENCODE DECODE SEND RECEIVE (resuelto)

JSON ENCODE DECODE SEND RECEIVE (resuelto)

Postby Maggiro » Sat Jul 14, 2018 8:36 am

Buenos Dias Comunidad:
Me preguntaba si éste tipo de rutina puede hacerse en xharbour + fivewin ...
Code: Select all  Expand view  RUN
   Private Function EnviarJson(ByVal documento As String, ByVal documento64bytes As String) As String
       Dim respuesta As String = ""
       Dim user As String = "20557103920ad_escon"
       Dim pass As String = "Escon2018"
       
       Dim rss_datos As JObject =
           New JObject(New JProperty("customer",
                           New JObject(
                               New Jproperty("username", user),
                               New Jproperty("password", pass))),
                       New JProperty("filename", documento),
                       New JProperty("filecontent", documento64bytes))
       Try
           Dim uri As New Uri("http://calidad.escondatagate.net/wsparser/rest/parserWS")
           Dim data As String = rss_datos.ToString()
           If (uri.Scheme = uri.SchemeHttp) Then
           
               Dim request As HttpWebRequest = HttpWebRequest.Create(uri)
               request.Method = WebRequestMethods.Http.Post
               request.ContentLength = data.length
               request.ContentType = "application/json"
               
               Dim writer As New StreamWriter(Request.GetRequestStream())
               writer.write(data)
               writer.Close()
               
               Dim Response As HttpWebResponse = request.GetResponse()
               Dim reader As New StreamReader(response.GetResponsestream())
               Dim tmp As String = reader.ReadToEnd()
               response.Close()
           End If
       
       Catch ex As Exception
           respuesta = "-1"
       End Try
       
       Return respuesta
 


Desde ya muchas gracias por vuestro alcance ...
Saludos
Julio César Gómez Cortéz
Jultzem Experiencias
Lima - Perú
Last edited by Maggiro on Tue Jul 24, 2018 4:05 am, edited 1 time in total.
User avatar
Maggiro
 
Posts: 84
Joined: Thu Oct 14, 2010 3:26 am
Location: LIMA - PERU

Re: JSON ENCODE DECODE SEND RECEIVE

Postby anserkk » Sun Jul 15, 2018 1:55 pm

User avatar
anserkk
 
Posts: 1333
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: JSON ENCODE DECODE SEND RECEIVE (resuelto)

Postby Maggiro » Tue Jul 24, 2018 4:09 am

... muchas gracias anserkk ... con tu dato pude resolver
cerrando las pruebas publico el code ...
Muchos Saludos
Julio César Gómez Cortéz
Jultzem Experiencias
Lima - Perú
User avatar
Maggiro
 
Posts: 84
Joined: Thu Oct 14, 2010 3:26 am
Location: LIMA - PERU


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 58 guests