Skip to main content
ExLibris
  • Subscribe by RSS
  • Ex Libris Knowledge Center

    How to test the POST method of the X-service (like Update-Bor)

    • Article Type: General
    • Product: Aleph
    • Product Version: 19.01, 21, 22, 23

    Description:


    How can I test the POST method of the X-service - for example, Update-Bor?
     

    Resolution:

    What are POST method X-Services?
    Almost all of the X-Services exist in ALEPH are GET method X-Services , i.e. they can be activated using a simple URL written in the address bar. Such X-Services includes regular parameters which cannot be too long, and because of that can be included all in the address bar without reaching the limit allowed.

    However, there are two different X-Services. These two services are using POST method, i.e. they cannot be activated using a simple URL, but in order to be activated these two services, a special procedure needs to be written. The main reason for that is that one of the parameters sent to these X-Services is a long XML string that can be very long.

    These two X-Services are Update-Bor and Update-Doc.
    --------------------------------------------------------

    How to simulate Update-Bor X-Service activation?
    First, it is assumed that whoever wishes to simulate the Update-Bor X-Service already knows the service and it's required inputs.

    Setting parameters to the desired input you need for simulation:

    1) Library => This is the ADM library for the Patron to be updated / created. Default is USM50.

    If you wish to change it, then go to ./alephm/source/test_stress/test_x_server_upd_bor.pl and look for the following line:

    $form{'library'} = 'usm50' ;

    You might change 'usm50' to the desired ADM library.

    2) Update_Flag => This is the flag indicating whether Data Base should be updated. Default is No.

    If you wish to change it, then go to ./alephm/source/test_stress/test_x_server_upd_bor.pl and look for the following line:

    $form{'update_flag'} = 'N' ;

    You might change 'N' to 'Y'.

    3) Xml_full_req => Includes a long XML input string. In order to simulate the X-Service you MUST make sure there is a file under:

    ./[adm_library]/scratch directory, with the input XML string.

    Input file format can be created using Util / F / 2 / 5 / 2 for a Patron in the ADM library.

    Activating the service after parameters were set correctly:

    1) dlib into ADM library in which input file resides under.

    2) asm test_stress.

    3) The following command will simulate the X-Service (input_file_name = The name of the input file placed under $data_scratch):

    perl test_x_server_upd_bor.pl $data_scratch/$input_file_name

    The result will be the output XML retrieved by the Update-Bor X-Service. The results can also be redirected to a file.


    ---------------------------------------------------

    How to simulate Update-Doc X-Service activation?
    First, it is assumed that whoever wishes to simulate the Update-Doc X-Service already knows the service and it's required inputs.

    Setting parameters to the desired input you need for simulation:

    1) Library => This is the BIB library for the Document to be updated / created / Deleted. Default is USM01.

    If you wish to change it, then go to ./alephm/source/test_stress/test_x_server_upd_doc.pl and look for the following line:

    $form{'library'} = 'usm01' ;

    You might change 'usm01' to the desired BIB library.

    2) User_Name => This is the user (staff) who tries to perform the changes to the Doc. Default is 'MASTER'.

    If you wish to change it, then go to ./alephm/source/test_stress/test_x_server_upd_doc.pl and look for the following line:

    $form{'user_name'} = 'MASTER' ;

    You might change 'MASTER' to a different user name.

    3) User_Password => This is the user's (staff) password. Default is 'MASTER'.

    If you wish to change it, then go to ./alephm/source/test_stress/test_x_server_upd_doc.pl and look for the following line:

    $form{'user_password'} = 'MASTER' ;

    You might change 'MASTER' to a different user password.

    4) Doc_Num => This is the doc number to be Updated. This field MUST be changed before simulating the X-Service since there is no possible default value for that.

    Before simulation, look for the following line:

    $form{'doc_num'} = 'XXXXXXXXX' ;

    You MUST replace 'XXXXXXXXX' with some doc number.

    5) Doc_Action => As cleared before, it is assumed that who ever got that far, already knows Update-DocX-Service, and its action's options. Default action for Update-Doc is 'UPDATE-CHK'.

    If you wish to change it, then go to ./alephm/source/test_stress/test_x_server_upd_doc.pl and look for the following line:

    $form{'doc_action'} = 'UPDATE-CHK' ;

    You might change 'UPDATE-CHK' to a different action, like 'UPDATE'.

    6) Xml_full_req => Includes a long XML input string. In order to simulate the X-Service you MUST make sure there is a file under:

    ./[bib_library]/scratch directory, with the input XML string.

    Input file format can be created in two stages:

    1) Create a set of documents per a defined search query, using Find X-Service.

    2) Based on set-number retrieved in first stage, pick up the desired entry in the set and use Present X-Service.

    The XML created for the document by Present X-Service can be used as a source for file.

    Activating the service after parameters were set correctly:

    1) dlib into BIB library in which input file resides under.

    2) asm test_stress.

    3) The following command will simulate the X-Service (input_file_name = The name of the input file placed under $data_scratch):

     

     

    perl test_x_server_upd_doc.pl $data_scratch/$input_file_name

     

    4) The result will be the output XML retrieved by the Update-Doc X-Service. The results can also be redirected to a file.


    • Article last edited: 06-July-2016