Maua fa'amaoniga tala'aga mai le Auaunaga Blockchain e fa'aaoga ai le SAP ABAP

by | Tesema 29, 2019 | Polokalame ABAP, Blockchain

Itulau Amata » sua » ABAP » Polokalame ABAP » Maua fa'amaoniga tala'aga mai le Auaunaga Blockchain e fa'aaoga ai le SAP ABAP

faʻatomuaga - O lenei pou o se vaega o le Blockchain i luga ole SAP Cloud Platform ma Polokalame ABAP faasologa.

I lenei laʻasaga, o le a matou toe valaʻauina le auaunaga poloka poloka e faʻaaoga ai le faʻailoga na matou teuina i luga o le laasaga. Ona matou mauaina lea o le talafaasolopito o fefaʻatauaiga mai poloka poloka.

METHOD get_proof_history.
 FA'AMATALAGA: lo_http_client ITULAU FA'AALI I if_http_client.
 FA'AMATALAGA: tali TYPE manoa, lv_url TYPE manoa, lv_auth TYPE manoa, lv_auth2 TYPE manoa.
 FA'AMATALAGA : lv_initial_url TYPE manoa VALUE ' '.
 AFAI iv_object_id E LE'O MATAMATA.
 *** Mauaina o Tulaga Faailoga: AMATA O le t_entry, access_token TYPE manoa, token_type TYPE manoa, expires_in TYPE n LENGTH 8, lautele TYPE manoa, jti TYPE manoa, END OF t_entry .
 ITIGA: t_entry_map ITULAGA FA'AVAE LAVA O le t_ulu fa'atasi ma ki tutasi access_token.
 FA'AMATALAGA: m_tusitusi TYPE t_entry.
 FA'AMATALAGA: lr_instance ITIGA FA'AALI I /ui5/cl_json_parser.
 FAITAU OBJECT lr_instance.
 VALAAU METOFAGA ia te a'u->get_token.
 AFAI gv_token E LE'O MATAMATA.
 * fa'amaumauga: itab TUSI FA'ATA'IGA O manoa.
 * fa'amaumauga: access_tok type string.
 * SPLIT gv_token i le '"' INTO TABLE itab.
 * taumafai.
 * lv_auth2 = itab[4].
 * pu'e cx_sy_itab_line_not_found.
 * FAAMAUINA.
 /ui2/cl_json=>deserialize( EXPORTING json = gv_token pretty_name = /ui2/cl_json=>pretty_mode-camel_case CHANGING data = m_entries ).
 lv_auth2 = m_tusi-tulaga_token.
 gv_token = gv_token+17.
 FA'A'U'U'U'U'U lv_auth2 I LE lv_auth FA'AVAE I LE va.
 ENDIF.
 FA'AMATALAGA lv_object_id TYPE manoa.
 lv_object_id = iv_object_id.
 FA'ALIU lv_object_id I LE MAITAI LOTO.
 FA'AFEAU lv_initial_url lv_object_id I totonu lv_url.  "Faʻapipiʻi Faʻamau URL ma le Object ID e maua ai le Talosaga URL" fatu HTTP client e ala ile url CALL METHOD cl_http_client=>create_by_url EXPORTING url = lv_url IMPORTING client = lo_http_client EXCEPTIONS argument_not_found = 1 plugin_not_active = 2 internal_error = 3 ISI.
 " Avanoa API Endpoints "https://blockchain-service.cfapps.sap.hana.ondemand.com/blockchain/proofOfHistory/api/v1 "https://blockchain-service.cfapps.eu10.hana.ondemand.com/blockchain /proofOfHistory/api/v1 "https://blockchain-service.cfapps.us10.hana.ondemand.com/blockchain/proofOfHistory/api/v1 IF sy-subrc <> 0.
 "sese le taulimaina ENDIF.
 "fa'atulagaina ole auala ole talosaga lo_http_client->request->set_method('GET').
 "creatung Auth value * lv_auth2 = 'Fa'avae '.
 "faaopoopo ulutala * lo_http_client->request->set_header_field(igoa = 'Ituaiga-Ituaiga' tau = 'application/x-www-form-urlencoded').
 lo_http_client->request->set_header_field(igoa = 'Accept' value = 'application/json').
 lo_http_client->request->set_header_field(igoa = 'Fa'atagaina' tau = lv_auth).
 * lo_http_client->request->set_header_field(igoa = 'APIKey' tau = 'zBoCpDtkaT9jexRjtMk0J98Rs8izmQi1' ).
 "Available Security Schemes for productive API Endpoints" OAuth 2.0 CALL METHOD lo_http_client->send EXCEPTIONS http_communication_failure = 1 http_invalid_state = 2 http_processing_failed = 3 http_invalid_timeout = 4 ISI = 5.
 AFAI sy-subrc = 0.
 VALAAU METOTIA lo_http_client->maua tuusaunoaga http_communication_failure = 1 http_invalid_state = 2 http_processing_failed = 3 ISI = 5.
 ENDIF.
 AFAI sy-subrc = 1.
 "mea sese i le taulimaina ev_response = 'http_communication_failure'.
 ELSEIF sy-subrc = 2.
 ev_response = 'http_invalid_state'.
 ELSEIF sy-subrc = 3.
 ev_response = 'http_processing_failed'.
 ELSEIF sy-subrc = 0.
 tali = lo_http_client->tali->get_cdata().
 * TUSI: 'tali:', tali.
 ev_response = tali.
 ISI.
 ev_response = 'Sese le iloa'.
 ENDIF.
 ENDIF.

 

tusitala

0 Faamatalaga

Tuuina atu se Faamatalaga

o le a le lomia lou tuatusi imeli. fanua manaomia ua faailogaina *

O lenei 'upega tafaʻilagi e faʻaaogaina le Akismet e faʻaitiitia le spam. Aoao pe faapefea ona faʻasoa lau faʻamatalaga faʻamatalaga.

tusitala