More than two years ago the last version of the json4sapnw library was published. Json4sapnw is a Addon for ABAP based SAP NetWeaver systems and it is free for the SAP community.
The new version includes an HTTP client implementation to execute RESTful JSON Webservices with only a few lines of code. Some other optimizations and bugfixes are included too.
With the new JSON Client webservices like OpenWeatherMap.org can be requested to get the current weather data into an SAP system.
Here is a code example (SAP ABAP):
* ---------- create a new client lr_request ?= /cex/cl_jmp_json_request=>create_with_url( lv_url ). IF lr_request IS INITIAL. exit_error 'no client available'. ENDIF. * ---------- execute IF lr_request->execute( ) NE abap_true. WRITE: / 'execution failed' COLOR 6. write_error. ENDIF. * ----------- get result IF lr_request->is_response( ) EQ abap_true. * check valid json IF lr_request->is_response_json( ) EQ abap_true. * process json response lr_json ?= lr_request->get_response_json( ). PERFORM process_json USING lr_json. ELSE. WRITE: / 'no valid json output' COLOR 6. ENDIF. ENDIF. * ----------- finally destroy lr_request->destroy( ).
Are You interested in? Get the new version from the Sourceforce Project Site!