Question

How to use URL parameter in Routing Address?


Userlevel 5
Badge +14
  • Hero (Customer)
  • 275 replies

Hi,

 

I am practicing about web services. I would like to change the URL with a parameter. It is working while static value. However, I couldn’t do it with a URL parameter. I didn’t set anything about query parameters. But the application message throws “Error while processing query parameters in the request” error. How can I solve it?

 

DECLARE
query_params plsqlap_document_api.document;
key_ref_ VARCHAR2(1000);
username_ VARCHAR2(50);
BEGIN
key_ref_ := 'Github Test';
username_ := '/' || 'hasanyucel';
url_params := plsqlap_document_api.new_document('url_params');
plsqlap_document_api.add_attribute(url_params, 'parameter1', username_);

plsql_rest_sender_api.call_rest_endpoint_empty_body2(rest_service_ => 'GITHUB_PROFIL',
url_params_ => url_params,
callback_func_ => 'github_rest_api.rest_callback_test',
http_method_ => 'GET',
query_parameters_ => NULL,
key_ref_ => key_ref_);
END;

 


16 replies

Userlevel 2
Badge +6

Hello,

 

I have the same problem. I have defined base URL in Routing Address with {parameter1} placeholder. But it gets not replaced when sending Application Message.

Userlevel 3
Badge +10

Hi @hhy38,

Please refer to the following documentation for more information:

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

Userlevel 5
Badge +14

@ashen_malaka_ranasinghe Hi,

 

I read this documentation many times. But, I couldn’t find the problem. There could be a bug in our version. Or I made a mistake. The scenario looks correct.

 

Userlevel 5
Badge +14

Hello,

 

I have the same problem. I have defined base URL in Routing Address with {parameter1} placeholder. But it gets not replaced when sending Application Message.

Yes, the url not replacing with the parameter value.

Userlevel 5
Badge +14

Hello,

 

I have the same problem. I have defined base URL in Routing Address with {parameter1} placeholder. But it gets not replaced when sending Application Message.

I wrongly clicked the Best Answer choice. :( 

Userlevel 3
Badge +10

Hi @hhy38,

Can you mention the AP:PS10 version (UPD) if possible?

Userlevel 2
Badge +6

Hello,

 

I have read the documentation a few times too, but no success so far.

I am working on Cloud 22.2.6

Userlevel 5
Badge +14

Hi @hhy38,

Can you mention the AP:PS10 version (UPD) if possible?

@ashen_malaka_ranasinghe We are using IFS 10 UPD 5.

Userlevel 2
Badge +6

My konfiguration is like this:

 

Executing my test script:

DECLARE
   xml_doc_           Plsqlap_Document_API.Document;
   url_               Plsqlap_Document_API.Document;
   json_structure_    VARCHAR2(32000) := 'TEST';
   url_param_attr_    VARCHAR2(32000);
   json_              clob;
BEGIN
  --url_ := PLSQLAP_DOCUMENT_API.New_Document('url_params');
  --PLSQLAP_DOCUMENT_API.Add_Attribute(url_,'parameter1','/posts');

  xml_doc_ := Plsqlap_Document_API.New_Document('TEST_DOC');
  Plsqlap_Document_API.Add_Attribute(xml_doc_, 'title', 'foo');
  Plsqlap_Document_API.Add_Attribute(xml_doc_, 'body', 'bar');
  Plsqlap_Document_API.Add_Attribute(xml_doc_, 'userId', '1');  
 
  Plsqlap_Document_API.To_Json(json_, xml_doc_);

  Plsql_Rest_Sender_API.Call_Rest_EndPoint2(rest_service_        => 'FLESTEPHS_REST_TEST',
                                             xml_                 => json_,
                                             --url_params_          => url_,
                                             callback_func_       => '',
                                             http_method_         => 'POST',
                                             fnd_user_            => Fnd_Session_API.Get_Fnd_User,
                                             sender_              => 'REST_SENDER1',
                                             subject_             => 'TEST'
                                             );
   
   COMMIT;
END;

 

I get Response:

 

When I change base URL in Routing Address to use placeholder it is like this:

 

DECLARE
   xml_doc_           Plsqlap_Document_API.Document;
   url_               Plsqlap_Document_API.Document;
   json_structure_    VARCHAR2(32000) := 'TEST';
   url_param_attr_    VARCHAR2(32000);
   json_              clob;
BEGIN
  url_ := PLSQLAP_DOCUMENT_API.New_Document('url_params');
  PLSQLAP_DOCUMENT_API.Add_Attribute(url_,'parameter1','/posts');

  xml_doc_ := Plsqlap_Document_API.New_Document('TEST_DOC');
  Plsqlap_Document_API.Add_Attribute(xml_doc_, 'title', 'foo');
  Plsqlap_Document_API.Add_Attribute(xml_doc_, 'body', 'bar');
  Plsqlap_Document_API.Add_Attribute(xml_doc_, 'userId', '1');  
 
  Plsqlap_Document_API.To_Json(json_, xml_doc_);

  Plsql_Rest_Sender_API.Call_Rest_EndPoint2(rest_service_        => 'FLESTEPHS_REST_TEST',
                                             xml_                 => json_,
                                             url_params_          => url_,
                                             callback_func_       => '',
                                             http_method_         => 'POST',
                                             fnd_user_            => Fnd_Session_API.Get_Fnd_User,
                                             sender_              => 'REST_SENDER1',
                                             subject_             => 'TEST'
                                             );
   
   COMMIT;
END;

 

Reponse is:

 

Userlevel 2
Badge +6

Edit: I found the problem in my Example above:

I used

PLSQLAP_DOCUMENT_API.Add_Attribute(url_,'parameter1','/posts');

 

but it has to be

PLSQLAP_DOCUMENT_API.Add_Attribute(url_,'parameter1','posts');

 

I will now try my customization instead of this simple plsql example.

Userlevel 5
Badge +14

@flestephs Nice to you. But I tried with a backslash before. I didn’t work. :(

 
Userlevel 2
Badge +6

@ashen_malaka_ranasinghe 

Where can I find the value, the placeholder is replaced with? The Application Message does not show it (or I just cant find it?).

Maybe this will help hh38 to find the error.

Userlevel 7
Badge +20

Hi @hhy38 @flestephs 

 

Try below :)

url_ := PLSQLAP_DOCUMENT_API.New_Document('URL_PARAMETERS');

PLSQLAP_DOCUMENT_API.Add_Attribute(url_,'parameter1','/posts');

 

As I remember, the URL_PARAMETERS is the correct way to declare, not as url_params

 

Cheers!

Damith

Userlevel 5
Badge +14

Hi Damith @dsj ,

 

Thank you. I tried but it still didn’t replace the parameter. :(

What is wrong I couldn’t understand. The scenario looks easy.

 

 

DECLARE
url_params plsqlap_document_api.document;
BEGIN

url_params := PLSQLAP_DOCUMENT_API.New_Document('URL_PARAMETERS');
plsqlap_document_api.add_attribute(url_params, 'parameter1', '/hasanyucel');

plsql_rest_sender_api.call_rest_endpoint_empty_body2(rest_service_ => 'GITHUB_PROFIL',
url_params_ => url_params,
callback_func_ => 'github_rest_api.rest_callback_test',
http_method_ => 'GET',
query_parameters_ => NULL,
key_ref_ => 'Github Test');
END;

 

Userlevel 7
Badge +20

Hi @hhy38 

Probably it could be a bug in your version 😔

I have done a test in cloud 23R1 and it worked fine for me

  1. Created a routing address with parameterized URL

 

  1. created a routing rule
  2. Used your code block. Found out that the document name doesn’t matter

 

Captured the request from the backend with parameter

 

Userlevel 5
Badge +14

@dsj 

Thank you Damith. It was a practice. If there will be a real scenario in the future. I will open a ticket.

Reply