Skip to main content

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 v1:1]: Unexpected character '{' (code 123) in prolog; expected '<'  at trow,col {unknown-source}]: o1,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.

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


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


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 a1: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}]: c1,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.. 


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

 


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


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