Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

PowerBuilder Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(PowerBuilder) POST GovTalk XML to https://vrep1-t.cssz.cz/VREP/submission

Demonstrates how to POST a GovTalk XML message to https://vrep1-t.cssz.cz/VREP/submission

PDF Documentation is at http://www.cssz.cz/NR/rdonlyres/0ACDBB35-F78A-4B1A-8258-7249B55C788E/0/csszpodavacidotazovaciprotokol20110608.pdf

Chilkat ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

integer li_rc
integer li_Success
oleobject loo_Xml
oleobject loo_Bd
oleobject loo_Gzip
oleobject loo_Cert
oleobject loo_Crypt
oleobject loo_Http
oleobject loo_Resp
integer li_StatusCode

// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

// First prepare the XML body that is to be GZip compressed and then encrypted.
// Build the following XML..

// Use the online tool at http://tools.chilkat.io/xmlCreate.cshtml
// to generate the XML creation code that follows this XML.

// <?xml version="1.0" encoding="utf-8" ?>
// <pvpoj xmlns="http://schemas.cssz.cz/POJ/PVPOJ2016">
//     <prehled verze="2016.0" typPrehledu="N">
//         <okres>
//             <kodOSSZ>119</kodOSSZ>
//             <nazevOSSZ>Praha 9</nazevOSSZ>
//         </okres>
//         <obdobi>
//             <mesic>1</mesic>
//             <rok>2018</rok>
//         </obdobi>
//         <zamestnavatel>
//             <vs>9992002999</vs>
//             <IC>49710999</IC>
//             <nazev>SIT &amp; KHASO v.o.s.</nazev>
//             <adresa>
//                 <ulice>Na sp�leni�ti</ulice>
//                 <cisloDomu>517</cisloDomu>
//                 <obec>Praha 9</obec>
//                 <PSC>19032</PSC>
//                 <stat>CZ</stat>
//             </adresa>
//         </zamestnavatel>
//         <pojistne>
//             <uhrnVymerovacichZakladu>1104</uhrnVymerovacichZakladu>
//             <pojistneZamestnance>175</pojistneZamestnance>
//             <pojistneZamestnavatele>2826</pojistneZamestnavatele>
//             <pojistneCelkem>4301</pojistneCelkem>
//         </pojistne>
//         <platebniUdaje>
//             <bankaCisloUctu>012345789/0800</bankaCisloUctu>
//         </platebniUdaje>
//         <pracovnik>
//             <jmeno>Matt</jmeno>
//             <prijmeni>Smith</prijmeni>
//             <telefon>606796999</telefon>
//             <email>admin@chilkatsoft.com</email>
//         </pracovnik>
//         <datumVyplneni>2018-03-02</datumVyplneni>
//         <poznamka />
//     </prehled>
// </pvpoj>

loo_Xml = create oleobject
// Use "Chilkat_9_5_0.Xml" for versions of Chilkat < 10.0.0
li_rc = loo_Xml.ConnectToNewObject("Chilkat.Xml")
if li_rc < 0 then
    destroy loo_Xml
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_Xml.Tag = "pvpoj"
loo_Xml.AddAttribute("xmlns","http://schemas.cssz.cz/POJ/PVPOJ2016")
loo_Xml.UpdateAttrAt("prehled",1,"verze","2016.0")
loo_Xml.UpdateAttrAt("prehled",1,"typPrehledu","N")
loo_Xml.UpdateChildContent("prehled|okres|kodOSSZ","119")
loo_Xml.UpdateChildContent("prehled|okres|nazevOSSZ","Praha 9")
loo_Xml.UpdateChildContent("prehled|obdobi|mesic","1")
loo_Xml.UpdateChildContent("prehled|obdobi|rok","2018")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|vs","9992002999")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|IC","49710999")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|nazev","SIT & KHASO v.o.s.")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|adresa|ulice","Na sp�leni�ti")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|adresa|cisloDomu","517")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|adresa|obec","Praha 9")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|adresa|PSC","19032")
loo_Xml.UpdateChildContent("prehled|zamestnavatel|adresa|stat","CZ")
loo_Xml.UpdateChildContent("prehled|pojistne|uhrnVymerovacichZakladu","1104")
loo_Xml.UpdateChildContent("prehled|pojistne|pojistneZamestnance","175")
loo_Xml.UpdateChildContent("prehled|pojistne|pojistneZamestnavatele","2826")
loo_Xml.UpdateChildContent("prehled|pojistne|pojistneCelkem","4301")
loo_Xml.UpdateChildContent("prehled|platebniUdaje|bankaCisloUctu","012345789/0800")
loo_Xml.UpdateChildContent("prehled|pracovnik|jmeno","Matt")
loo_Xml.UpdateChildContent("prehled|pracovnik|prijmeni","Smith")
loo_Xml.UpdateChildContent("prehled|pracovnik|telefon","606796999")
loo_Xml.UpdateChildContent("prehled|pracovnik|email","admin@chilkatsoft.com")
loo_Xml.UpdateChildContent("prehled|datumVyplneni","2018-03-02")
loo_Xml.UpdateChildContent("prehled|poznamka","")

loo_Xml.EmitCompact = 1
loo_Xml.EmitXmlDecl = 0

// Emit the XML into bd.
loo_Bd = create oleobject
// Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0
li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData")

loo_Bd.AppendString(loo_Xml.GetXml(),"utf-8")

// GZip compress the bd contents.
loo_Gzip = create oleobject
// Use "Chilkat_9_5_0.Gzip" for versions of Chilkat < 10.0.0
li_rc = loo_Gzip.ConnectToNewObject("Chilkat.Gzip")

// The Filename is not an actual file on disk, but is just the filename string stored in the gzip compressed format.
loo_Gzip.Filename = "pvpoj.xml"
loo_Gzip.CompressBd(loo_Bd)

// Encrypt the contents using the government provided cert.
loo_Cert = create oleobject
// Use "Chilkat_9_5_0.Cert" for versions of Chilkat < 10.0.0
li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert")

li_Success = loo_Cert.LoadFromFile("qa_data/govs/czech/pvpoj/DISCSSZ2019.cer")
if li_Success <> 1 then
    Write-Debug loo_Cert.LastErrorText
    destroy loo_Xml
    destroy loo_Bd
    destroy loo_Gzip
    destroy loo_Cert
    return
end if

loo_Crypt = create oleobject
// Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")

loo_Crypt.CryptAlgorithm = "pki"

loo_Crypt.Pkcs7CryptAlg = "aes"
loo_Crypt.KeyLength = 256

li_Success = loo_Crypt.SetEncryptCert(loo_Cert)
if li_Success <> 1 then
    Write-Debug loo_Crypt.LastErrorText
    destroy loo_Xml
    destroy loo_Bd
    destroy loo_Gzip
    destroy loo_Cert
    destroy loo_Crypt
    return
end if

li_Success = loo_Crypt.EncryptBd(loo_Bd)
if li_Success <> 1 then
    Write-Debug loo_Crypt.LastErrorText
    destroy loo_Xml
    destroy loo_Bd
    destroy loo_Gzip
    destroy loo_Cert
    destroy loo_Crypt
    return
end if

// At this point, bd contains the gzip compressed / encrypted XML.

// Build the following GovTalkMessage XML:

// <?xml version="1.0" encoding="utf-8"?>
// <GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
//   <EnvelopeVersion>2.0</EnvelopeVersion>
//   <Header>
//     <MessageDetails>
//       <Class>CSSZ_PVPOJ</Class>
//       <Qualifier>request</Qualifier>
//       <Function>submit</Function>
//       <TransactionID />
//       <AuditID />
//       <CorrelationID />
//       <ResponseEndPoint PollInterval="0" />
//       <Transformation>XML</Transformation>
//       <GatewayTest />
//       <GatewayTimestamp />
//     </MessageDetails>
//     <SenderDetails>
//       <IDAuthentication>
//         <SenderID />
//         <Authentication>
//           <Method>clear</Method>
//           <Role />
//           <Value />
//         </Authentication>
//       </IDAuthentication>
//       <X509Certificate />
//       <EmailAddress>admin@chilkatsoft.com</EmailAddress>
//     </SenderDetails>
//   </Header>
//   <GovTalkDetails>
//     <Keys>
//       <Key Type="vars">9992888999</Key>
//     </Keys>
//     <GatewayAdditions />
//   </GovTalkDetails>
//   <Body>
//     <Message xmlns="http://www.cssz.cz/XMLSchema/envelope" version="1.2" eType="PVPOJ16">
//       <Header>
//         <Signature xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">Signature goes here</Signature>
//         <Vendor productName="Abc xyz. s r.o. JKL .NET Client" version="6.0.2.0" />
//       </Header>
//       <Body xmlns:dt="urn:schemas-microsoft-com:datatypes" encrypted="yes" contentEncoding="gzip" dt:dt="bin.base64">Base64 goes here
// </Body>
//     </Message>
//   </Body>
// </GovTalkMessage>
// 

// Use the online tool at http://tools.chilkat.io/xmlCreate.cshtml
// to generate this code.

loo_Xml.Clear()
loo_Xml.Tag = "GovTalkMessage"
loo_Xml.AddAttribute("xmlns","http://www.govtalk.gov.uk/CM/envelope")
loo_Xml.UpdateChildContent("EnvelopeVersion","2.0")
loo_Xml.UpdateChildContent("Header|MessageDetails|Class","CSSZ_PVPOJ")
loo_Xml.UpdateChildContent("Header|MessageDetails|Qualifier","request")
loo_Xml.UpdateChildContent("Header|MessageDetails|Function","submit")
loo_Xml.UpdateChildContent("Header|MessageDetails|TransactionID","")
loo_Xml.UpdateChildContent("Header|MessageDetails|AuditID","")
loo_Xml.UpdateChildContent("Header|MessageDetails|CorrelationID","")
loo_Xml.UpdateAttrAt("Header|MessageDetails|ResponseEndPoint",1,"PollInterval","0")
loo_Xml.UpdateChildContent("Header|MessageDetails|Transformation","XML")
loo_Xml.UpdateChildContent("Header|MessageDetails|GatewayTest","")
loo_Xml.UpdateChildContent("Header|MessageDetails|GatewayTimestamp","")
loo_Xml.UpdateChildContent("Header|SenderDetails|IDAuthentication|SenderID","")
loo_Xml.UpdateChildContent("Header|SenderDetails|IDAuthentication|Authentication|Method","clear")
loo_Xml.UpdateChildContent("Header|SenderDetails|IDAuthentication|Authentication|Role","")
loo_Xml.UpdateChildContent("Header|SenderDetails|IDAuthentication|Authentication|Value","")
loo_Xml.UpdateChildContent("Header|SenderDetails|X509Certificate","")
loo_Xml.UpdateChildContent("Header|SenderDetails|EmailAddress","admin@chilkatsoft.com")
loo_Xml.UpdateAttrAt("GovTalkDetails|Keys|Key",1,"Type","vars")
loo_Xml.UpdateChildContent("GovTalkDetails|Keys|Key","9992888999")
loo_Xml.UpdateChildContent("GovTalkDetails|GatewayAdditions","")
loo_Xml.UpdateAttrAt("Body|Message",1,"xmlns","http://www.cssz.cz/XMLSchema/envelope")
loo_Xml.UpdateAttrAt("Body|Message",1,"version","1.2")
loo_Xml.UpdateAttrAt("Body|Message",1,"eType","PVPOJ16")
loo_Xml.UpdateAttrAt("Body|Message|Header|Signature",1,"xmlns:dt","urn:schemas-microsoft-com:datatypes")
loo_Xml.UpdateAttrAt("Body|Message|Header|Signature",1,"dt:dt","bin.base64")
loo_Xml.UpdateChildContent("Body|Message|Header|Signature","Signature goes here")
loo_Xml.UpdateAttrAt("Body|Message|Header|Vendor",1,"productName","Abc xyz. s r.o. JKL .NET Client")
loo_Xml.UpdateAttrAt("Body|Message|Header|Vendor",1,"version","6.0.2.0")
loo_Xml.UpdateAttrAt("Body|Message|Body",1,"xmlns:dt","urn:schemas-microsoft-com:datatypes")
loo_Xml.UpdateAttrAt("Body|Message|Body",1,"encrypted","yes")
loo_Xml.UpdateAttrAt("Body|Message|Body",1,"contentEncoding","gzip")
loo_Xml.UpdateAttrAt("Body|Message|Body",1,"dt:dt","bin.base64")

// Insert the contents of bd here:
loo_Xml.UpdateChildContent("Body|Message|Body",loo_Bd.GetEncoded("base64"))

// Show the XML to be sent to https://vrep1-t.cssz.cz/VREP/submission
loo_Xml.EmitCompact = 0
Write-Debug loo_Xml.GetXml()
loo_Xml.EmitCompact = 1

// ----------------------------------------------------------
// POST the XML to https://vrep1-t.cssz.cz/VREP/submission

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")

loo_Resp = loo_Http.PostXml("https://vrep1-t.cssz.cz/VREP/submission",loo_Xml.GetXml(),"utf-8")
if loo_Http.LastMethodSuccess <> 1 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Xml
    destroy loo_Bd
    destroy loo_Gzip
    destroy loo_Cert
    destroy loo_Crypt
    destroy loo_Http
    return
end if

// Examine the response status code (200 = success)
li_StatusCode = loo_Resp.StatusCode
Write-Debug "Response status code = " + string(li_StatusCode)

// The response body should be XML.
// Load it into a Chilkat XML object to get it in indented format for viewing..
loo_Xml.Clear()
loo_Xml.LoadXml(loo_Resp.BodyStr)
loo_Xml.EmitCompact = 0
Write-Debug loo_Xml.GetXml()

// Output is:
// <GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
//     <EnvelopeVersion>2.0</EnvelopeVersion>
//     <Header>
//         <MessageDetails>
//             <Class>CSSZ_PVPOJ</Class>
//             <Qualifier>acknowledgement</Qualifier>
//             <Function>submit</Function>
//             <TransactionID />
//             <CorrelationID>1B6336D5ACE949CDB944424CB2D54401</CorrelationID>
//             <ResponseEndPoint PollInterval="60">https://vrep1-t.cssz.cz/VREP/poll</ResponseEndPoint>
//             <GatewayTimestamp>2018-07-02T22:23:41.310</GatewayTimestamp>
//         </MessageDetails>
//         <SenderDetails />
//     </Header>
//     <GovTalkDetails>
//         <Keys />
//     </GovTalkDetails>
//     <Body>
//         <Signature xmlns="http://www.podani.gov.cz/TxE/timestamp" Version="1.0">
//             <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
//             <TimeStamp>
//                 <date>20180702</date>
//                 <time>22:23:41</time>
//             </TimeStamp>
//             <SignatureValue>MIIORwYJKoZIhvcNAQcCo ... bBNE6MeXmk2siMuvY=</SignatureValue>
//         </Signature>
//     </Body>
// </GovTalkMessage>
// 

// Hint: Use the online tool at http://tools.chilkat.io/xmlParse.cshtml
// to generate XML parsing code based on a sample response..

destroy loo_Resp


destroy loo_Xml
destroy loo_Bd
destroy loo_Gzip
destroy loo_Cert
destroy loo_Crypt
destroy loo_Http

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.