PowerBuilder
PowerBuilder
Aruba Fatturazione Elettronica ppd
See more Aruba Fatturazione Examples
If pddAvailable is true then this method retrieves the Preservation package as a Zip file of financial messages, specifying its request ID (requestID). If however pddAvailable is false, in other words, the Preservation package is not available, the HTTP status code 404 is returned.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_Json
oleobject loo_Resp
string ls_ZipFilename
li_Success = 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Implements the following CURL command:
// curl -X POST https://ws.fatturazioneelettronica.aruba.it/services/ClientRequest/pdd \
// -H "Accept: application/json" \
// -H "Content-Type: application/json;charset=UTF-8" \
// -d '{
// "userName" : "ARUBA0000",
// "password" : "ArubaPwd",
// "requestID" : "XZLA9SZ9ZW"
// }'
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
// Use this online tool to generate code from sample JSON:
// Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "userName": "ARUBA0000",
// "password": "ArubaPwd",
// "requestID": "XZLA9SZ9ZW"
// }
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("userName","ARUBA0000")
loo_Json.UpdateString("password","ArubaPwd")
loo_Json.UpdateString("requestID","XZLA9SZ9ZW")
loo_Http.SetRequestHeader("Content-Type","application/json;charset=UTF-8")
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
li_Success = loo_Http.HttpJson("POST","https://ws.fatturazioneelettronica.aruba.it/services/ClientRequest/pdd",loo_Json,"application/json",loo_Resp)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
destroy loo_Resp
return
end if
// Returns a response that looks like this:
// HTTP/1.1 200 OK
// Content-Disposition: attachment; filename="IT01879020517_LI_0001.conservazione.zip"
// Content-Type: application/zip
// Accept-Ranges: bytes
// Content-Length: 8
//
// <binary>
if loo_Resp.StatusCode <> 200 then
Write-Debug "response status code = " + string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Http
destroy loo_Json
destroy loo_Resp
return
end if
// If we get here, the response contains a .zip.
// Save to the filename specified in the Content-Disposition.
ls_ZipFilename = loo_Resp.GetHeaderFieldAttr("Content-Disposition","filename")
li_Success = loo_Resp.SaveBodyBinary(ls_ZipFilename)
Write-Debug "Success."
destroy loo_Http
destroy loo_Json
destroy loo_Resp