Skip to main content

I’m trying to utilise the plsql_rest_sender_api.call_rest_endpoint method passing the CLOB.  As soon as i try to follow the documentation to add url parameters the method fails with wrong number or types of arguments in call to ‘CALL_REST_ENDPOINT’.

My problem is, if i don’t use url parameters then i’ll need to set up multiple routing addresses for each specific endpoint.  This will cause issues when the endpoint changes from test to production as i’ll need to change them all.

Has anyone managed to utilise the url_params_ functionality within plsql_rest_sender_api.call_rest_endpoint ?

Hi @chriselliston,

  • First create a system parameter to store the url 

INSERT INTO OBJECT_PROPERTY_TAB(OBJECT_LU,OBJECT_KEY,PROPERTY_NAME,VALIDATION_ENABLED) VALUES (:component,'SystemParameter',:parameter_name,'FALSE');

  •  Add the value using the client according the env
  •  Use the parameter value inside your api call  (Object_Property_Api.Get_Value)

Thanks & Best Regards,

Wimali


Hi Wimali

Thanks for this.

Is this in the documentation anywhere? It’s the first I’ve seen of manually adding values to a table on this subject.

Regards

Chris


Hi chriselliston,

 

hope this will helps

https://docs.ifs.com/techdocs/foundation1/040_administration/240_integration/300_ifs_connect/010_configure_connect/060_transport_connectors/configure_rest_transport_connector.htm

 

Regards,

Sahan


Hi @chriselliston ,

 

My suggestion is like a customization but please refer the Sahan’s  documentation which  is more suitable for your requirement.

Hi @chriselliston,

  • First create a system parameter to store the url 

INSERT INTO OBJECT_PROPERTY_TAB(OBJECT_LU,OBJECT_KEY,PROPERTY_NAME,VALIDATION_ENABLED) VALUES (:component,'SystemParameter',:parameter_name,'FALSE');

  •  Add the value using the client according the env
  •  Use the parameter value inside your api call  (Object_Property_Api.Get_Value)

Thanks & Best Regards,

Wimali

 

Thanks & Best Regards,

Wimali


I’ve followed that documentation and as soon as i try to use url_params_ in the overloaded method to pass a CLOB (plsql_rest_sender_api.call_rest_endpoint) IFS complains that i don’t have the correct number of arguments or type.

If i omit the url_params_ argument it works.

The other overloads for plsql_rest_sender_api.call_rest_endpoint don’t seem to hit the same error.

Regards

Chris


I have got it working.  The documentation indicates you should call plsql_rest_sender_api.call_rest_endpoint, pass in a clob and then use documents to create the url parameters.  This doesn’t seem to work.

if you call plsql_rest_sender_api.call_rest_endpoint2 you can pass in a clob and then use documents rather than records to create the url parameters as per the documentation.


Here’s an example of what I did with a few changes, hope it helps…

Some of the changes I made: Use XML of REST call for Json string, Add Text Accept to Header, use parameter of rest api in routing rule context based conditions, parameter is set in code. Any errors should show up in the application message screen in IFS. Also, Call_Rest_EndPoint2 was the only one I could get to work with the parameters I had available.

  1. Create Routing Address:

 

 

In Additional Header Paramters:

Accept= text/html, application/xml;q=0.9, */*;q=0.8

The user ID and Password defined here will be used, it is not necessary to code.

 

  1. Create Routing Rule (Outbound)

    In Destination Address place the Address you created in #1 Above.
    In Content based conditions use a parameterized rest:

https://companyname.com:port/int/ifsapplications/projection/v1/CSalesPart.svc/{parameter1} In code, you will replace parameter1 with the Method Call of the API.

 

  1. Write your PL/SQL Code, you can put your JSON in the field called XML. It’s misleading naming but it works. In my opinion there should be a JSON field. I used PL/SQL Developer and the TEST Window  file to test.

 

 

-- Created on 9/15/2021 by JONU

declare

  -- Local variables here

 

  procedure do_Ifs_Rest is

     url  PLSQLAP_DOCUMENT_API.Document;

     header PLSQLAP_DOCUMENT_API.Document;

     xml CLOB;   

  begin

    dbms_output.put_line('test start');

    begin 

      url := PLSQLAP_DOCUMENT_API.New_Document('url_params');

 

      PLSQLAP_DOCUMENT_API.Add_Attribute(url,'parameter1','GetText');

          

      header := PLSQLAP_DOCUMENT_API.New_Document('header_params');

 

      PLSQLAP_DOCUMENT_API.Add_Attribute(header,'Accept-Language', 'en-US');

 

      xml := '{ "TextRequest":{"Contract":"Jonathan Test"}}';

 

      plsql_rest_sender_API.Call_Rest_EndPoint2(

      rest_service_ => 'https://companyname.cloudapp.azure.com:port/int/ifsapplications/projection/v1/CSalesPart.svc/{parameter1}',

       xml_ => xml,

       url_params_ => url,

       callback_func_ => 'REST_callback_Test',

       http_method_ => 'POST',

       http_req_headers_ => NULL,

       query_parameters_ => NULL,

       header_params_ => header);         

       dbms_output.put_line('test end');

    exception when others then

        dbms_output.put_line('Error: ' || SQLERRM);

    end;  

  end;

begin

  -- Test statements here

  do_Ifs_Rest();

end;