Hello,

Using the PL SQL code, I get a response from the server in the form of an XML string.

Here, actually, the code by which I receive XML .

create or replace procedure publish_cinema_even is req utl_http.req; res utl_http.resp; url varchar2(4000) := 'https://alsytto.onlyoffice.eu/api/2.0/authentication.xml?userName=roma@roma.by&password=password'; name varchar2(4000); buffer varchar2(4000); content varchar2(4000) := '{}'; begin utl_http.set_wallet ('file:c:\app\wallet2','test1234'); utl_http.set_detailed_excp_support (true); req := utl_http.begin_request(url, 'POST',' HTTP/1.1'); --UTL_HTTP.set_wallet('file:/c:\app\oraUser\product\12.1.0\dbhome_1\BIN\wallets', 'test1234'); --utl_http.set_header(req, 'user-agent', 'mozilla/4.0'); --utl_http.set_header(req, 'content-type', 'application/json'); utl_http.set_header(req, 'Content-Length', length(content)); utl_http.write_text(req, content); res := utl_http.get_response(req); -- process the response from the HTTP call begin loop utl_http.read_line(res, buffer); dbms_output.put_line(buffer); end loop; utl_http.end_response(res); exception when utl_http.end_of_body then utl_http.end_response(res); end; end publish_cinema_even; 

And after getting this response from the server:

 <result><count>1</count><status>0</status><statusCode>201</statusCode><response><token>oAf5U23dQqn0cSQzNuOwN7CLW7R+fiv4xV5Te7/YZ9IERMivUwUiQA9abO2U+maXGgygOwIZtLoLWFN04q1k4AV0+vGOsJiQadjt+4iOq0vs5mNImF5DsknhPsN9qA1N</token><expires>2017-09-14T10:53:56.2760087+03:00</expires><sms>false</sms><phoneNoise /></response></result> 

Help parse this response and write the token to a variable.

    1 answer 1

    To get the token from the xml found in the variable buffer to the variable token use the following query:

      select extractValue(xmltype(buffer),'//token') into token from DUAL;