Skip to main content

I have an issue with loading a JSON string from a webserver.

 

Loading of a JSON string via the linkage area is not accepting the string as input

 

for example,  the following call is sent

 

GET /ssi/1.0/validationIdList?endClientType=SSI_egm&endClientId=ABC_123&configurationId=1235813&validationListId=1347118&numValidationIds=5&valIdListExpired=false HTTP/1.1
Accept: application/json
Accept-Charset: utf-8

 

I am not sure how using XBIS i can accept the above string as input into a cobol program (fields in BOLD) and use the relevant parameters as part of input to read files etc

 

Any information would be appreciated


#linuxcobol
#XBIS
#JSON
#RMCOBOL

I have an issue with loading a JSON string from a webserver.

 

Loading of a JSON string via the linkage area is not accepting the string as input

 

for example,  the following call is sent

 

GET /ssi/1.0/validationIdList?endClientType=SSI_egm&endClientId=ABC_123&configurationId=1235813&validationListId=1347118&numValidationIds=5&valIdListExpired=false HTTP/1.1
Accept: application/json
Accept-Charset: utf-8

 

I am not sure how using XBIS i can accept the above string as input into a cobol program (fields in BOLD) and use the relevant parameters as part of input to read files etc

 

Any information would be appreciated


#linuxcobol
#XBIS
#JSON
#RMCOBOL

Chris, those are query parameters, not JSON.  

The BIS request handler places the query parameters into a portion of the BIS request document.  The format is documented in Appendix B of the BIS  User's Guide.  Using the standard soap-to-cobol.xsl, the query parameters can be imported into a cobol structure like the following:

01  s--parameters.  *> or this can be subordinate to the 01 level
   03  s--parameter occurs 100.  *> 100 is arbitrary
       05  s--name pic x(40).
       05  s--value pic x(200).  

This is demonstrated in the BIS tutorial which recent versions have installed along with BIS.

Hope this helps.

Best regards,
Tom Morrison


I have an issue with loading a JSON string from a webserver.

 

Loading of a JSON string via the linkage area is not accepting the string as input

 

for example,  the following call is sent

 

GET /ssi/1.0/validationIdList?endClientType=SSI_egm&endClientId=ABC_123&configurationId=1235813&validationListId=1347118&numValidationIds=5&valIdListExpired=false HTTP/1.1
Accept: application/json
Accept-Charset: utf-8

 

I am not sure how using XBIS i can accept the above string as input into a cobol program (fields in BOLD) and use the relevant parameters as part of input to read files etc

 

Any information would be appreciated


#linuxcobol
#XBIS
#JSON
#RMCOBOL

Hi Tom

Thanks for your input.

I have added the information, especially viewing the separate tutorials as part of accessing the data.

Within the working storage area i added the following

 

      78 L-Method-Name-Read   VALUE "Read".

      78 Service-URI          VALUE "{{Value('validatelist.srf',HTMLDECODE,MAKEABS)}}".

      78 Service-Name         VALUE "validatelist".

      78 SOAP-Action-URI      VALUE "http://chris".

      78 Method-Namespace-URI VALUE "http://chris".

      78 HTTP-Method-DELETE   VALUE "DELETE".

      78 HTTP-Method-GET      VALUE "GET".

      78 HTTP-Method-POST     VALUE "POST".

      78 HTTP-Method-PUT      VALUE "PUT".

      01 SOAP-Request-Response.

         10 HTTP-Method                   VALUE HTTP-Method-GET.

            88 HTTP-Method-Is-POST        VALUE HTTP-Method-POST.

            88 HTTP-Method-Is-GET         VALUE HTTP-Method-GET.

         10 SOAP-Address                  VALUE Service-URI.

         10 SOAP-Action-Prefix            VALUE SOAP-Action-URI.

         10 Method-Namespace-Indicator    PIC X.

            88 Method-Namespace-Match     VALUE "1".

            88 Method-Namespace-Mismatch  VALUE "0".

         10 Interface-Name                VALUE Service-Name.

         10 Method-Name PIC X(100)        VALUE SPACES.

            88 Method-Is-Read                   VALUE L-Method-Name-Read.

         10 Fault-Area.

            20 FaultCode                  PIC X(10) VALUE SPACES.

            20 FaultString                PIC X(30) VALUE SPACES.

            20 FaultDetail                PIC X(80) VALUE SPACES.

         10 Read--Method-Name             PIC X(4) value L-Method-Name-Read.

         10 Read--Method-Parameters.

            20 Input-Parameters.

               30 endClientType           PIC X(10).

               30 endClientID             PIC X(10).

30 configurationId         PIC X(10).

30 validationListId        PIC X(10).

30 numValidationIds        PIC X(3).

30 valIdListExpired        PIC X(7).

               30 endClientType--name     PIC X(13) VALUE "endClientType".

               30 endClientID--name       PIC X(11) VALUE "endClientID".

30 configurationId--name   PIC X(16) VALUE "configurationId".

30 validationListId--name  PIC X(17) VALUE "validationListId".

30 numValidationIds--name  PIC X(16) VALUE "numValidationIds".

30 valIdListExpired--name  PIC X(16)  VALUE "valIdListExpired".

 

The linkage section has been set up as follows

 

       LINKAGE SECTION.

       01 Command-Argument.
          10 Argument-Length PIC S9(4) BINARY (2).
          10 Argument-Text.
             20 Argument-Char PIC X OCCURS 0 TO 100 TIMES
                   DEPENDING ON Argument-Length.       

        PROCEDURE DIVISION USING Command-Argument.

 

Within the procedure division before own code is the following

 

           XML SET XSL-PARAMETERS
               "Method_Namespace"     Method-Namespace-URI.   *> all
           If Not XML-OK Go To Z End-If.

           Call "B$ReadRequest"
                   Using OMITTED BIS-Request-String
                   Giving BIS-Status
           If Not BIS-OK Go To Z.

      *    At this point, the request elements
      *    are available in the text at which BIS-Request-String points.
      
           Initialize SOAP-Request-Response to Default.
           Initialize SOAP-Request-Response All to Value.

           XML IMPORT TEXT
               SOAP-Request-Response
               BIS-Request-String
               "SOAP-Request-Response"      *> model data-name
               "soap_to_cobol.xsl".         *> stylesheet for transform

               
      *         "Request-params"
      *         "request_params_to_cobol.xsl".
      
           If Not XML-OK Go To Z.
            display "Method:  " method-name
            display endClientType of input-parameters of Read--Method-Parameters
            display endClientID  of input-parameters of Read--Method-Parameters
            display configurationId  of input-parameters of Read--Method-Parameters
            display validationListId of input-parameters of Read--Method-Parameters
            display numValidationIds  of input-parameters of Read--Method-Parameters
            display valIdListExpired of input-parameters of Read--Method-Parameters
           

In the Logs,  the above displays are all showing spaces, even the following is used as the call

 

wget http://chris:8088/xbis/wbtitoaus/validatelist.srf?endClientType=SSI_egm&endClientId=ABC_123&configurationId=1235813&validationListId=1347118&numValidationIds

 

I would have thought that the parameters listed above would all contain the values as per input via the WGET

 

Chris


I have an issue with loading a JSON string from a webserver.

 

Loading of a JSON string via the linkage area is not accepting the string as input

 

for example,  the following call is sent

 

GET /ssi/1.0/validationIdList?endClientType=SSI_egm&endClientId=ABC_123&configurationId=1235813&validationListId=1347118&numValidationIds=5&valIdListExpired=false HTTP/1.1
Accept: application/json
Accept-Charset: utf-8

 

I am not sure how using XBIS i can accept the above string as input into a cobol program (fields in BOLD) and use the relevant parameters as part of input to read files etc

 

Any information would be appreciated


#linuxcobol
#XBIS
#JSON
#RMCOBOL

Chris,

My guess is that you probably want to follow the AJAX/JSON design pattern taught in tutorial3.  This is described in the section titled Not Quite a Web Service near the end of the PDF document.  The mechanism you are using above is for a SOAP web service, which is quite structured and exclusively XML.  Your original post indicates the expectation of JSON, which is definitely not SOAP.  You are probably expecting a REST type of architecture.

Tom


I have an issue with loading a JSON string from a webserver.

 

Loading of a JSON string via the linkage area is not accepting the string as input

 

for example,  the following call is sent

 

GET /ssi/1.0/validationIdList?endClientType=SSI_egm&endClientId=ABC_123&configurationId=1235813&validationListId=1347118&numValidationIds=5&valIdListExpired=false HTTP/1.1
Accept: application/json
Accept-Charset: utf-8

 

I am not sure how using XBIS i can accept the above string as input into a cobol program (fields in BOLD) and use the relevant parameters as part of input to read files etc

 

Any information would be appreciated


#linuxcobol
#XBIS
#JSON
#RMCOBOL
Thanks Tom

I am working using the Tutorial3 process at the moment

given that i can get a display of the input parameters, it is only showing the first parameter from the REST type of input, is there a way of getting all parameters to show ?

Chris