RE: Consuming external webservice on screens
Hi,
Today, I don't have time to do a CRUD example, but for now this can help you.
Thanks to http://www.ediy.co.nz/vbjson-json-parser-library-in-vb6-xidc55680.html
Download file http://appsmexico.mx/shared_folder/vb6_json.rar
Add reference to:
C:\Windows\System32\msxml6.dll (Microsoft XML)
C:\Windows\System32\scrrun.dll (Microsoft Scripting Runtime)
C:\Program Files\Common Files\System\ado\msado.15.dll (Microsoft ActiveX Data Objects)
Add objects to proyect:
JSON.bas
cJSONScript.cls
cStringBuilder.cls
ThisScreen:
Option Explicit
Private Sub CNumber_Chk(ChkStrg As String, retval As Integer)
Dim vXmlHttp As MSXML2.XMLHTTP
Set vXmlHttp = New MSXML2.XMLHTTP
Dim vWebServiceUrl As String
Dim vResponse As String
vWebServiceUrl = "http://vmwamdeveloper/un-mx.net/WebServices/rest/Pantallas/GetPantallaById?pantallaId=" & ChkStrg
Call vXmlHttp.open("GET", vWebServiceUrl, False)
vXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Call vXmlHttp.send
vResponse = vXmlHttp.responseText
Dim vPantalla As Object
Set vPantalla = Json_Deserialize(vResponse)
Call SetObjectValue("cName", vPantalla.Item("Nombre"))
Set vXmlHttp = Nothing
End Sub