Skip to main content
Question

Apps10 Rest_Sender_API doesn't accept JSON?


Forum|alt.badge.img+7
  • Sidekick (Partner)
  • 45 replies

Hi,

I was using PLSQL_Rest_Sender_API on IFS application 10. I want to send a JSON payload to a REST endpoint. I created a CLOB in JSON format in my Utility API. But when I call the procedure “Call_Rest_Endpoint1” it doesn’t accept a JSON clob. It gives the following error in the generated application message -

 

ORA-20105: PlsqlapServer.ERRINV: XMLREADER_NEXT:Cannot move to next XML event at [1:1]: Unexpected character '{' (code 123) in prolog; expected '<'  at [row,col {unknown-source}]: [1,1]  Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'  at [row,col {unknown-source}]: [1,1]

 

I tried other Call_Rest_EndpointX versions of the procedure but no luck.

Does IFS Application 10 not support JSON? There are procedures in Rest sender API in Cloud that accepts JSON payload.

 

I think I have to do manual work here by writing my own transformer. Not sure even if that would work.

6 replies

Forum|alt.badge.img+4
  • Sidekick (Partner)
  • 6 replies
  • May 23, 2024

Hi @Rohit did you figure out a solution for this?


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • 45 replies
  • May 24, 2024

Hi @levnimesn ,

Yes, I found on other community posts, the Call_Rest_Endpoint2 procedure accepts JSON payload in this xml_ parameter -

 

 

Here payload_ is a CLOB containing JSON data.

Probably I did some mistake earlier while trying out this procedure. But this does work.

 

Thanks,

Rohit


Forum|alt.badge.img+4
  • Sidekick (Partner)
  • 6 replies
  • May 27, 2024

Did you have to modify anything in the set up?

I am using the Call_Rest_Endpoint2 method right now. I have used this for other customers where it worked to send a JSON message out. But I get this 

‘ORA-20105: PlsqlapServer.ERRINV: XMLREADER_NEXT:Cannot move to next XML event at [1:1]: Unexpected character '{' (code 123) in prolog; expected '<'  at [row,col {unknown-source}]: [1,1]  Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'  at [row,col {unknown-source}]: [1,1]’

error for this customer. Did you format your message differently from the original try ?

 

  json_  CLOB;
  url_params_         Plsqlap_Document_API.Document;

BEGIN

...

 IF vendor_part_no_ IS NOT NULL THEN
      main_           := new JSON_OBJECT_T;
      supplier_array_ := new JSON_ARRAY_T;
      header_obj_     := new JSON_OBJECT_T;
      header_obj_.put('messageType', 'ONE_EXP_SUPPLIER_STOCK');
      main_.put('header', header_obj_);

      FOR rec_ in getsuppliers LOOP
          supplier_obj_ := new JSON_OBJECT_T;
          supplier_obj_.put('supplierId', rec_.vendor_no);
          supplier_obj_.put('associationNo', rec_.assoc_no);
          supplier_obj_.put('supplierPartNo', rec_.vendor_part_no);
          supplier_obj_.put('contract', rec_.contract);
          supplier_array_.append(supplier_obj_);
      END LOOP; 

      main_.put('message', supplier_array_);

      json_ := main_.to_clob;


        url_params_ := Plsqlap_Document_API.New_Document('urlParams');
        plsql_rest_sender_API.Call_Rest_Endpoint2(rest_service_  => 'ONE_EXP_SUPPLIER_STOCK',
                                                  xml_           => json_,
                                                  url_params_    => url_params_,
                                                  callback_func_ => NULL,
                                                  http_method_   => 'POST',
                                                  sender_        => 'IFS');

 

I get a JSON object out from this, but the message goes to the above mentioned error.. 


Forum|alt.badge.img+7
  • Author
  • Sidekick (Partner)
  • 45 replies
  • May 28, 2024

@levnimesn 

I don’t think I did any extra setup.

Try removing the url_params_ parameter and then see if the error comes or not.

If the error still comes, try putting a simple json_ with one attribute value. Create it using hardcoded string (VARCHAR2)

 


Forum|alt.badge.img+10
  • Hero (Customer)
  • 59 replies
  • May 29, 2024

The error seems to be data related, especially if it work for other customers.

Do you have any special characters in the data in the json?  Canyou run the get_suppliers query and review the results?  For example, are there any quotation marks in the supplier part numbers?

Hope this helps


Forum|alt.badge.img+19

You say “the message goes to the above mentioned error”.

If it is the application message you are talking about:

How does the routing address look like on the routing rule that is used?

Is the JSON message correct when you download from application message?


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