JSON ENCODE DECODE SEND RECEIVE (resuelto)

JSON ENCODE DECODE SEND RECEIVE (resuelto)

Postby Maggiro » Sat Jul 14, 2018 10:02 pm

Buenos Dias Comunidad:
Me preguntaba si éste tipo de rutina puede hacerse en xharbour + fivewin ...
Code: Select all  Expand view
   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ú
User avatar
Maggiro
 
Posts: 84
Joined: Thu Oct 14, 2010 3:26 am
Location: LIMA - PERU

Re: JSON ENCODE DECODE SEND RECEIVE (resuelto)

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

Gracias al dato recibido por anserkk pude resolver
Muchos Saludos
Julio César Gómez Cortéz
Jultzem Experiencias
User avatar
Maggiro
 
Posts: 84
Joined: Thu Oct 14, 2010 3:26 am
Location: LIMA - PERU


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests