Skip to main content
Question

How to use URL parameter in Routing Address?


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)
  • 318 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

Forum|alt.badge.img+6
  • Do Gooder (Partner)
  • 18 replies
  • October 2, 2023

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.


ashen_malaka_ranasinghe
Hero (Employee)
Forum|alt.badge.img+11

hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 2, 2023

@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.

 


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 2, 2023
flestephs wrote:

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.


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 2, 2023
flestephs wrote:

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. :( 


ashen_malaka_ranasinghe
Hero (Employee)
Forum|alt.badge.img+11

Hi @hhy38,

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


Forum|alt.badge.img+6
  • Do Gooder (Partner)
  • 18 replies
  • October 2, 2023

Hello,

 

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

I am working on Cloud 22.2.6


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 2, 2023
ashen_malaka_ranasinghe wrote:

Hi @hhy38,

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

@ashen_malaka_ranasinghe We are using IFS 10 UPD 5.


Forum|alt.badge.img+6
  • Do Gooder (Partner)
  • 18 replies
  • October 2, 2023

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:

 


Forum|alt.badge.img+6
  • Do Gooder (Partner)
  • 18 replies
  • October 2, 2023

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.


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 2, 2023

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

 

Forum|alt.badge.img+6
  • Do Gooder (Partner)
  • 18 replies
  • October 2, 2023

@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.


dsj
Superhero (Partner)
Forum|alt.badge.img+22
  • Superhero (Partner)
  • 836 replies
  • October 2, 2023

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


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 3, 2023

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;

 


dsj
Superhero (Partner)
Forum|alt.badge.img+22
  • Superhero (Partner)
  • 836 replies
  • October 3, 2023

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

 


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 318 replies
  • October 4, 2023

@dsj 

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings