Cobol Foro

Cobol Foro (https://www.cobolforo.es/index.php)
-   PowerCOBOL (ActiveX, v4 - v11) (https://www.cobolforo.es/forumdisplay.php?f=9)
-   -   [Duda] Ajuda em Chillkat ActiveX (https://www.cobolforo.es/showthread.php?t=1828)

Paulo 8 de enero de 2025 17:29

Ajuda em Chillkat ActiveX
 
Hola a todos.

Tenho necessidade de implementar um soap usando o chillkat v9.5.0, uma vez que tem diversas vantagens neste caso, sobretudo o de ser independente do sistema operativo em termos de TLS.

O codigo em VB.Net é:
Código VB:
  1. Dim resp As Chilkat.HttpResponse = http.PostXml(pWebService, pSoapFile, "utf-8")

O que fiz em PowerCobol v10 é:
Código COBOL:
  1. INVOKE ChilkatHttp1 "PostXml" USING pWebService pSoapFile "utf-8" RETURNING ChilkatHttpResponse1.

Mas dá sempre em cobsnap e erro.
Alguém tem experiencia nestes casos que possa ajudar ?

Gracias

fastpho 8 de enero de 2025 19:16

Hola @Paulo
Con estos objetos (ChilkatXml ,ChilkatHttp1 , ChilkatHttpResponse ) de Chillkat no he trabajado pero con otros si.

Encontre un ejemplo en vb6 Link
https://www.example-code.com/vb6/soap_web_service.asp

Traducido a PowerCobol algo asi seria :
Espero esto te ayude en algo.
Código COBOL:
  1.  WORKING-STORAGE SECTION.
  2.  01 success      pic s9(9) comp-5.
  3.  01 XmlFile      pic x(50) value spaces.
  4.  01 endpointUrl  pic x(50) value spaces.
  5.  01 xmlContent   pic x(50) value spaces.
  6.  01 xmlCharset   pic x(5)  value spaces.
  7.  01 responseStatusCode  pic s9(9) comp-5.
  8.  
  9.  PROCEDURE       DIVISION.
  10. *objetos usados
  11. *    ChilkatXml1
  12. *    ChilkatHttpResponse1
  13. *    ChilkatHttp1
  14.  
  15.      *>-----------------------
  16.     *> xml
  17.      move "ukPostCodeSoap.xml" to XmlFile.
  18.      INVOKE ChilkatXml1 "LoadXml" USING XmlFile RETURNING success.
  19.      if success not = 1 then
  20.         display "error"
  21.         exit program
  22.      else
  23.         display "ok"
  24.      end-if.
  25.       INVOKE ChilkatXml1 "GetXml" RETURNING xmlContent.
  26.       display "xmlContent : " , xmlContent.
  27.    
  28.      *>-----------------------
  29.     *> http
  30.  
  31.      INVOKE ChilkatHttp1 "SetRequestHeader" USING "SOAPAction" "http://www.webserviceX.NET/GetUKLocationByPostCode".
  32.      INVOKE ChilkatHttp1 "SetRequestHeader" USING "Content-Type" "text/xml; charset=utf-8".
  33.    
  34.      *>-------------------------
  35.     *> response
  36.      move "http://www.webservicex.net/uklocation.asmx" to  endpointUrl.
  37.      move "utf-8" to     xmlCharset.
  38.      INVOKE ChilkatHttp1 "PostXml" USING endpointUrl xmlContent xmlCharset RETURNING ChilkatHttpResponse1.
  39.      
  40.      move "StatusCode" OF ChilkatHttpResponse1 to responseStatusCode.
  41.      display "Response Status Code: " , responseStatusCode.
  42.      

Saludos...

Paulo 10 de enero de 2025 10:45

Gracias.
Vou adaptar e testar.


La franja horaria es GMT +2. Ahora son las 23:46.

Powered by: vBulletin, Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.