Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Lianja) POST GovTalk XML to https://vrep1-t.cssz.cz/VREP/submissionDemonstrates 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
// 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 & 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>Murdock</prijmeni> // <telefon>606796999</telefon> // <email>admin@chilkatsoft.com</email> // </pracovnik> // <datumVyplneni>2018-03-02</datumVyplneni> // <poznamka /> // </prehled> // </pvpoj> loXml = createobject("CkXml") loXml.Tag = "pvpoj" loXml.AddAttribute("xmlns","http://schemas.cssz.cz/POJ/PVPOJ2016") loXml.UpdateAttrAt("prehled",.T.,"verze","2016.0") loXml.UpdateAttrAt("prehled",.T.,"typPrehledu","N") loXml.UpdateChildContent("prehled|okres|kodOSSZ","119") loXml.UpdateChildContent("prehled|okres|nazevOSSZ","Praha 9") loXml.UpdateChildContent("prehled|obdobi|mesic","1") loXml.UpdateChildContent("prehled|obdobi|rok","2018") loXml.UpdateChildContent("prehled|zamestnavatel|vs","9992002999") loXml.UpdateChildContent("prehled|zamestnavatel|IC","49710999") loXml.UpdateChildContent("prehled|zamestnavatel|nazev","SIT & KHASO v.o.s.") loXml.UpdateChildContent("prehled|zamestnavatel|adresa|ulice","Na sp�leni�ti") loXml.UpdateChildContent("prehled|zamestnavatel|adresa|cisloDomu","517") loXml.UpdateChildContent("prehled|zamestnavatel|adresa|obec","Praha 9") loXml.UpdateChildContent("prehled|zamestnavatel|adresa|PSC","19032") loXml.UpdateChildContent("prehled|zamestnavatel|adresa|stat","CZ") loXml.UpdateChildContent("prehled|pojistne|uhrnVymerovacichZakladu","1104") loXml.UpdateChildContent("prehled|pojistne|pojistneZamestnance","175") loXml.UpdateChildContent("prehled|pojistne|pojistneZamestnavatele","2826") loXml.UpdateChildContent("prehled|pojistne|pojistneCelkem","4301") loXml.UpdateChildContent("prehled|platebniUdaje|bankaCisloUctu","012345789/0800") loXml.UpdateChildContent("prehled|pracovnik|jmeno","Matt") loXml.UpdateChildContent("prehled|pracovnik|prijmeni","Murdock") loXml.UpdateChildContent("prehled|pracovnik|telefon","606796999") loXml.UpdateChildContent("prehled|pracovnik|email","admin@chilkatsoft.com") loXml.UpdateChildContent("prehled|datumVyplneni","2018-03-02") loXml.UpdateChildContent("prehled|poznamka","") loXml.EmitCompact = .T. loXml.EmitXmlDecl = .F. // Emit the XML into bd. loBd = createobject("CkBinData") loBd.AppendString(loXml.GetXml(),"utf-8") // GZip compress the bd contents. loGzip = createobject("CkGzip") // The Filename is not an actual file on disk, but is just the filename string stored in the gzip compressed format. loGzip.Filename = "pvpoj.xml" loGzip.CompressBd(loBd) // Encrypt the contents using the government provided cert. loCert = createobject("CkCert") llSuccess = loCert.LoadFromFile("qa_data/govs/czech/pvpoj/DISCSSZ2019.cer") if (llSuccess <> .T.) then ? loCert.LastErrorText release loXml release loBd release loGzip release loCert return endif loCrypt = createobject("CkCrypt2") loCrypt.CryptAlgorithm = "pki" loCrypt.Pkcs7CryptAlg = "aes" loCrypt.KeyLength = 256 llSuccess = loCrypt.SetEncryptCert(loCert) if (llSuccess <> .T.) then ? loCrypt.LastErrorText release loXml release loBd release loGzip release loCert release loCrypt return endif llSuccess = loCrypt.EncryptBd(loBd) if (llSuccess <> .T.) then ? loCrypt.LastErrorText release loXml release loBd release loGzip release loCert release loCrypt return endif // 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. loXml.Clear() loXml.Tag = "GovTalkMessage" loXml.AddAttribute("xmlns","http://www.govtalk.gov.uk/CM/envelope") loXml.UpdateChildContent("EnvelopeVersion","2.0") loXml.UpdateChildContent("Header|MessageDetails|Class","CSSZ_PVPOJ") loXml.UpdateChildContent("Header|MessageDetails|Qualifier","request") loXml.UpdateChildContent("Header|MessageDetails|Function","submit") loXml.UpdateChildContent("Header|MessageDetails|TransactionID","") loXml.UpdateChildContent("Header|MessageDetails|AuditID","") loXml.UpdateChildContent("Header|MessageDetails|CorrelationID","") loXml.UpdateAttrAt("Header|MessageDetails|ResponseEndPoint",.T.,"PollInterval","0") loXml.UpdateChildContent("Header|MessageDetails|Transformation","XML") loXml.UpdateChildContent("Header|MessageDetails|GatewayTest","") loXml.UpdateChildContent("Header|MessageDetails|GatewayTimestamp","") loXml.UpdateChildContent("Header|SenderDetails|IDAuthentication|SenderID","") loXml.UpdateChildContent("Header|SenderDetails|IDAuthentication|Authentication|Method","clear") loXml.UpdateChildContent("Header|SenderDetails|IDAuthentication|Authentication|Role","") loXml.UpdateChildContent("Header|SenderDetails|IDAuthentication|Authentication|Value","") loXml.UpdateChildContent("Header|SenderDetails|X509Certificate","") loXml.UpdateChildContent("Header|SenderDetails|EmailAddress","admin@chilkatsoft.com") loXml.UpdateAttrAt("GovTalkDetails|Keys|Key",.T.,"Type","vars") loXml.UpdateChildContent("GovTalkDetails|Keys|Key","9992888999") loXml.UpdateChildContent("GovTalkDetails|GatewayAdditions","") loXml.UpdateAttrAt("Body|Message",.T.,"xmlns","http://www.cssz.cz/XMLSchema/envelope") loXml.UpdateAttrAt("Body|Message",.T.,"version","1.2") loXml.UpdateAttrAt("Body|Message",.T.,"eType","PVPOJ16") loXml.UpdateAttrAt("Body|Message|Header|Signature",.T.,"xmlns:dt","urn:schemas-microsoft-com:datatypes") loXml.UpdateAttrAt("Body|Message|Header|Signature",.T.,"dt:dt","bin.base64") loXml.UpdateChildContent("Body|Message|Header|Signature","Signature goes here") loXml.UpdateAttrAt("Body|Message|Header|Vendor",.T.,"productName","Abc xyz. s r.o. JKL .NET Client") loXml.UpdateAttrAt("Body|Message|Header|Vendor",.T.,"version","6.0.2.0") loXml.UpdateAttrAt("Body|Message|Body",.T.,"xmlns:dt","urn:schemas-microsoft-com:datatypes") loXml.UpdateAttrAt("Body|Message|Body",.T.,"encrypted","yes") loXml.UpdateAttrAt("Body|Message|Body",.T.,"contentEncoding","gzip") loXml.UpdateAttrAt("Body|Message|Body",.T.,"dt:dt","bin.base64") // Insert the contents of bd here: loXml.UpdateChildContent("Body|Message|Body",loBd.GetEncoded("base64")) // Show the XML to be sent to https://vrep1-t.cssz.cz/VREP/submission loXml.EmitCompact = .F. ? loXml.GetXml() loXml.EmitCompact = .T. // ---------------------------------------------------------- // POST the XML to https://vrep1-t.cssz.cz/VREP/submission loHttp = createobject("CkHttp") loResp = loHttp.PostXml("https://vrep1-t.cssz.cz/VREP/submission",loXml.GetXml(),"utf-8") if (loHttp.LastMethodSuccess <> .T.) then ? loHttp.LastErrorText release loXml release loBd release loGzip release loCert release loCrypt release loHttp return endif // Examine the response status code (200 = success) lnStatusCode = loResp.StatusCode ? "Response status code = " + str(lnStatusCode) // The response body should be XML. // Load it into a Chilkat XML object to get it in indented format for viewing.. loXml.Clear() loXml.LoadXml(loResp.BodyStr) loXml.EmitCompact = .F. ? loXml.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.. release loResp release loXml release loBd release loGzip release loCert release loCrypt release loHttp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.