Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending UBL EInvoice
Message
From
19/11/2022 05:59:20
 
 
To
18/11/2022 11:54:11
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
01685364
Message ID:
01685376
Views:
48
I tried but without success. Code is
CLEAR ALL
CLEAR
SET SAFETY OFF

CRLF = CHR(13)+CHR(10)

UBLFile = "FAKTURE\245_2022.xml"

data = FILETOSTR(UBLFile)
FileName = JUSTFNAME(UBLFile)

boundary = "WebKitFormBoundary7MA4YWxkTrZu0gW"  
m.ApiKey="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

m.RequestId = TTOC(DATETIME(), 1) + SYS(2015)

SET TEXTMERGE TO "ProbaEFakt.txt" NOSHOW
SET TEXTMERGE ON

TEXT
--<<m.boundary>>
Content-Disposition: form-data; name = 'data'; filename=<<FileName>>
Content-Type: text/xml

<<data>>
--<<m.boundary>>-- <<CRLF>>
ENDTEXT

SET TEXTMERGE TO

m.lcContent = FILETOSTR("ProbaEFakt.txt")

m.lcContent = STRTRAN(m.lcContent, CHR(13)+CHR(10)+'--WebKitFormBoundary7MA4YWxkTrZu0gW')

m.liContent = LEN(m.lcContent)

m.loXMLHTTP=CREATEOBJECT("Msxml2.XMLHTTP.6.0")

url = "https://demoefaktura.mfin.gov.rs/api/publicApi/sales-invoice/ubl/upload?requestId="+m.RequestId

m.loXMLHTTP.Open("POST", url, .f.)

m.loXMLHTTP.setRequestHeader('Host', 'demoefaktura.mfin.gov.rs')
m.loXMLHTTP.setRequestHeader('Content-type', 'multipart/form-data; charset=utf-8; boundary=' + m.boundary)
m.loXMLHTTP.setRequestHeader('Content-Length', m.liContent)
m.loXMLHTTP.SetRequestHeader("accept", "aplication/json")
m.loXMLHTTP.SetRequestHeader("ApiKey", m.ApiKey)

m.loXMLHTTP.Send(m.lcContent)

m.Result = m.loXMLHttp.ResponseText
wait wind STR(m.loXMLHttp.Status) + " " + m.loXMLHttp.StatusText
Result is 400 Bad request with responsetext
{"Message":"Multipart body length limit 16384 exceeded.","FieldName":"","ErrorCode":"XmlInvalid"}

How to solve this (before next error :-) )?

Zoran,

See if the thread at https://www.levelextreme.com/Home/ViewPage?Activator=1021&ID=1682832 can be of any help.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform