1. Mario Francisco Celleri
  2. PowerBuilder
  3. Tuesday, 7 June 2022 17:01 PM UTC

Hi guys;

 

I have a problem with a web service response.

 

It retrieve an html format doc, and we need to load the data contained on it into a database. Is there any way or technique in Power Builder 2019 R3 to "translate" the info of the HTML into valid data?

 

In the 2 files attached, I send 2 types of responses we received from the web service. (please see the "Tipo de Contribuyente" tag)

 

Please somebody can help us.

 

Thanks and regards.

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 7 June 2022 18:42 PM UTC
  2. PowerBuilder
  3. # 1

Hi Mario;

 What do you mean when you say  ...  "translate" the info of the HTML into valid data?

Regards .. Chris

Comment
  1. Armeen Mazda @Appeon
  2. Tuesday, 7 June 2022 19:22 PM UTC
He means remove all the HTML markup and save the raw data to a relational database.
  1. Helpful 1
  1. Chris Pollach @Appeon
  2. Tuesday, 7 June 2022 19:41 PM UTC
Hi Armeen ... if that is the case, then something like this should do the job (for example) ... https://www.nirsoft.net/utils/htmlastext.html

FWIW: There are lots of utilities that can do this HTML => TEXT. Just Google around Mario.
  1. Helpful 1
There are no comments made yet.
Mario Francisco Celleri Accepted Answer Pending Moderation
  1. Tuesday, 7 June 2022 21:28 PM UTC
  2. PowerBuilder
  3. # 2

Thanks Armeen and Chris.

 

Armeen is right, that's I search; remove all the HTML markup.

But Chris, that's we want to do from PowerBuilder directly?

Chris with the utility you  tell me; it's possible to use it from PowerBuilder?

 

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 8 June 2022 15:52 PM UTC
Hi Mario ... AFAIK - PB does not have the capability natively. You could start an OLE session using the IE Web Browser and after the HTML is loaded, command the WB to perform a "SaveAs Text". You cannot do that with the new built-in WB Control as there is no SaveAs() feature (yet).

Regards ... Chris
  1. Helpful 1
  1. Roland Smith
  2. Wednesday, 8 June 2022 17:18 PM UTC
This is strange, a web service usually returns XML or JSON. Returning HTML makes it sound like it is running a web page, not a true web service.
  1. Helpful 1
  1. Mario Francisco Celleri
  2. Thursday, 9 June 2022 03:35 AM UTC
Thanks Roland:



Maybe you¨re right: We use this to access. This is a goverment service.

li_re = inv_http.SendRequest ("POST", "https://srienlinea.sri.gob.ec/facturacion-internet/consultas/publico/ruc-datos2.jspa?ruc="; + ls_text_from,"False")
  1. Helpful
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Wednesday, 8 June 2022 18:26 PM UTC
  2. PowerBuilder
  3. # 3

Hi.

Another way to remove html tags in PB 2019 R3 and versions with updated rte control. You can place an rte control to your window. Then you can load your html and save it as txt.

rte_sample.InsertDocument (".\SRI HTML2.html", true, FileTypeHTML!)
rte_sample.savedocument(".\SRI HTML2.txt", FileTypeText!)

That way you have your text. Here is the result of the first one:

Inicio 
Desconectado
Inicio home home 
 

Autorizacion de Documentos


 
Busqueda de Contribuyentes/ Informacion del Contribuyente 
 
 
Informacion del Contribuyente
Fecha : 07-06-2022
Razon Social:
LARA XXX XXXXX XXXXXO

RUC:
0xxxxxxxxxxx1

 
Nombre Comercial:


Estado del Contribuyente en el RUC
Activo

Clase de Contribuyente
Otro

Tipo de Contribuyente
Persona Natural

Obligado a llevar Contabilidad
NO

Actividad Economica Principal
REPARACIi?½N Y MANTENIMIENTO DE: COMPUTADORAS DE ESCRITORIO, COMPUTADORAS PORTi?½TILES, SERVIDORES INFORMi?½TICOS, COMPUTADORAS DE MANO (ASISTENTES DIGITALES PERSONALES), UNIDADES DE DISCO MAGNi?½TICO, UNIDADES DE MEMORIA USB Y OTROS DISPOSITIVOS DE ALMACENAMIENTO; UNIDADES DE DISCO i?½PTICO (CD-RW, CD-ROM, D

Fecha de inicio de actividades
08-12-2016

Fecha de cese de actividades
31-10-2017

Fecha reinicio de actividades
24-03-2022

Fecha actualizacion
24-03-2022

Categoria Mi PYMES
No declarado



Establecimientos registrados 

Regresar 


Now you can study the output to write your custom import procedure to your datawindow. To do that you should use more than one html files as samples. May not work in older pb versions.

Andreas.

 

Comment
  1. Mario Francisco Celleri
  2. Thursday, 9 June 2022 03:45 AM UTC
Thanks a lot Andreas.



We will test this and hope it works.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.