Code:
- Actual code : It has one input and one output parms and I am retrieving the values and returning it back to webservices end point.
-
-
-
- Columns . . . : 1 100 Browse NEWCM/QRPGLESRC
- SEU==> HEDQTRGET
- FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0
- *************** Beginning of data ***************************************************************************************
- 0001.00 **free
- 0002.00 ctl-opt OPTION(*SRCSTMT : *NODEBUGIO : *SHOWCPY);
- 0007.00
- 0008.00 dcl-Pr main extpgm('HEDQTRGET');
- 0009.00 *n Char(1000);
- 0010.00 *n Char(16000000);
- 0011.00 end-Pr;
- 0012.00 dcl-Pi main ;
- 0013.00 p Char(1000);
- 0014.00 dataOut Char(16000000);
- 0015.00 end-Pi;
- 0016.00 /include IUTILITYP,IUTILITY
- 0017.00 /include UTILITYP,UTILITY
- 0018.00 /include APCJSONP,HEADQTRS
- 0019.00
- 0020.00 dcl-s routeParameters1 varChar(1000);
- 0021.00 dcl-s JSONOut1 varChar(16000000);
- 0022.00
- 0023.00 routeParameters1 = '?idpk=' + p; 190521
- 0025.00 callp json_get_Headquarters(routeParameters1:JSONOut1); 190521
- 0026.00
- 0027.00 dataout = JSONOut1;
- 0028.00
- 0029.00 *inlr = *on;
-
- F3=Exit F5=Refresh F9=Retrieve F10=Cursor F11=Toggle F12=Cancel
- F16=Repeat find F24=More keys
-
-
- Value of JSONOUT1 in debug
-
- > EVAL JSONOut1
- JSONOUT1 =
- ....5...10...15...20...25...30...35...40...45...50...55...60
- 1 '{"headquarterNumber":800000000,"headquarterName":"TEST8 '
- 61 ' ","headquarterAddr'
- 121 'essLine1":"ADR8 '
- 181 ' ","headquarterAddressLine2":"ADDRESS2 '
- 241 ' ","headquarterAddressLine3":"ADDRESS'
- 301 '3 ","headquarterC”};
-
- Response in Postman
- {
- "headquarterNumber": 800000000,
- "headquarterName": "TEST8 ",
- "headquarterAddressLine1": "ADR8 ",
- "headquarterAddressLine2": "ADDRESS2 ",
- "headquarterAddressLine3": "ADDRESS3 ",
- }
-
- Header info ( Content typ-Application/xml)
- Date →Thu, 23 May 2019 16:55:53 GMT
- Server →Apache
- X-Powered-By →IBM i
- Content-Length →1156
- Access-Control-Allow-Origin →*
- Access-Control-Allow-Headers →origin, x-requested-with, content-type
- Access-Control-Allow-Methods →PUT, GET, POST, DELETE, OPTIONS
- Connection →close
- Content-Type →application/xml
- Content-Language →en-US
-
-
- Webservices details
- Procedure name: MAIN
- HTTP request method: GET
- URI path template for method: *NONE
- HTTP response code output parameter: *NONE
- HTTP header array output parameter: *NONE
- Allowed input media types: *ALL
- Returned output media types: *XML_AND_JSON
- Input parameter mappings:
- Parameter name Data type Input source Identifier Default Value
- P char *QUERY_PARAM INPUT *NONE
-
-
-
-
-
-
-
- Now I am expecting the content type to be application/Json( it means I can set up header-application json or I can set up output media as JSON
- EVAL dataout
- DATAOUT =
- ....5...10...15...20...25...30...35...40...45...50...55...60
- 1 '{"headquarterNumber":800000000,"headquarterName":"TEST8 '
- 61 ' ","headquarterAddr'
- 121 'essLine1":"ADR8 '
- 181 ' ","headquarterAddressLine2":"ADDRESS2 '
- 241 ' ","headquarterAddressLine3":"ADDRESS'
- 301 '3 "}’
-
- Output shown in Postman with \
-
- {
- "DATAOUT": "{\"headquarterNumber\":800000000,\"headquarterName\":\"TEST8 \",\"headquarterAddressLine1\":\"ADR8 \",\"headquarterAddressLine2\":\"ADDRESS2 \",\"headquarterAddressLine3\":\"ADDRESS3 \”}”
-
- Header info
- 200 OK
- Time:191347 ms
- Size:1.47 KB
-
- Date →Thu, 23 May 2019 17:29:59 GMT
- Server →Apache
- X-Powered-By →IBM i
- Content-Length →1153
- Access-Control-Allow-Origin →*
- Access-Control-Allow-Headers →origin, x-requested-with, content-type
- Access-Control-Allow-Methods →PUT, GET, POST, DELETE, OPTIONS
- Connection →close
- Content-Type →application/json
- Content-Language →en-US
-
-
-
|
|