Alaska Software Inc. - RESTFUL SERVICE
Username: Password:
AuthorTopic: RESTFUL SERVICE
Slobodan StanojevicRESTFUL SERVICE
on Tue, 09 Nov 2021 17:23:09 +0100
* --- DEU

HILFE WIRD BENÖTIGT

Eleganten Beispiele geben die Adresse
https://doc.alaska-software.com/content/cls_xppcref_httpclient.html
ein Beispiel: Ausführen einer SOAP-Anfrage
Ich kann nirgendwo ein Beispiel finden: Ausführen einer RESTFUL-Anfrage

Ich habe versucht, ein Beispiel zu verwenden: Ausführen einer SOAP-Anfrage
auf den RESTFUL-Dienst zuzugreifen und ist fehlgeschlagen.
Ich kann nirgendwo eine Dokumentation zu dem Inhalt finden, der in die Zeile 
eingegeben wird
oHC: httpRequest: setHeader ("SOAPAction", "urn:send")

RESTFUL-Dienste ersetzen zunehmend SOAP-Dienste.
Ich benötige die Xbase ++-Technologie, um mit RESTFUL-Diensten zu arbeiten.
Bitte geben Sie mir Anweisungen, wo ich nach einer Antwort auf meine Frage 
suchen kann.


* --- ENG

HELP IS NEEDED

Elegant examples give the address
https://doc.alaska-software.com/content/cls_xppcref_httpclient.html
have an example: Performing a SOAP request
I can't find an example anywhere: Performing a RESTFUL request

I tried to use an example: Performing a SOAP request
to access the RESTFUL service and failed.
I can't find documentation anywhere about the content that is entered in the 
line
oHC: httpRequest: setHeader ("SOAPAction", "urn:send")

RESTFUL services are increasingly replacing SOAP services.
I need Xbase ++ technology to work with RESTFUL services.
Please give me instructions on where to look for an answer to my question.


Mein fehlgeschlagener Versuch hat folgenden Code:
My failed attempt has the following code:



* ---
oHC     := HttpClient():new()
oRM     := HttpRequestMessage():new( "https://demo.moj-eracun.rs/apis/v2/send" 
)
oHC:setAcceptType( "application/json" )
oHC:httpRequest:setHeader( "SOAPAction","urn:send")
oHC:httpRequest:setMethod( "POST" )
txt:=alltrim(memoread("c:\mojeracun\coba.json"))   txt JSON object (string)
oHC:httpRequest:setContent( txt )
 oHC:setAuthorization( "1908","cobasys123" )
oResponse := oHC:send(oRM)

JSON := oResponse:getContent()

memowrit("REST_getcontent.HTML",JSON)

 alternative:
cFile:= oHC:getFile("REST_getfile.HTML")
* ---



Ich erhalte kein Feedback RESTFUL Informationen, die ich von der Befehlszeile 
erhalte mit:
I do not receive feedback RESTFUL information that I receive from the command 
line with:


command line:

curl -X POST -d @"C:\mojeracun\COBA.json" https://demo.moj-
eracun.rs/apis/v2/send --header
"Content-Type: application/json; Content-Length: 0"

result:

{"ElectronicId":88782,
"DocumentNr":"F96-0002",
"DocumentTypeId":1,
"DocumentTypeName":"eRačun",
"StatusId":30,
"StatusName":"Sent",
"RecipientBusinessNumber":"HU123456780",
"RecipientBusinessUnit":"",
"RecipientBusinessName":"COBA INOSTRANA TEST",
"Created":"2021-11-08T22:52:31.0749764+01:00",
"Sent":"2021-11-08T22:52:31.8874787+01:00",
"Modified":"2021-11-08T22:52:31.903082+01:00",
"Delivered":null}


Angehängt ist die Datei coba.json
Attached is the file coba.json

Ich bin für jede Antwort sehr dankbar
I will be very grateful for any answer



COBA.json