Basic authentication with the RESTful WEb service and a Web Service reference

Hi all

We have made significant progress on getting an application to work with RESTful web services, but are now trying to understand how to lock a RESTful Web service while making it available for a particular application.

We use one of the 'emp' table sample web services come with Apex 4.2 and are trying to apply the Basic Auth to the WEb Service using Weblogic filter defined in the web.xml file. Which works very well. I now get challenged when I try to go to:

https://wlogic.edu/Apex/BNR/ACE/HR/empinfo/

And when I authenticate this challenge, I am able to get the data. (we are usiing the Weblogic-level LDAP authentication)

However, I'm not sure how to get even basic authentication to work with Web Service reference in my application. I see the error message in the application when I try to call this Web Service:

401 Unauthorized <

And I see:
"The request requires user authentication. It MUST contain a header field WWW-Authenticate (section 14.46) containing a fault that is applicable to the requested resource. The client MAY repeat the request with a suitable authorization (section 14.8) header field. If the request already includes identification of the authorization information»

How can I provide the credentials in the Web reference or provide credentials in the Application?
Web service works fine if I remove the auth basic RESTful web service in the Web.xml file.

We should NOT use basic auth and auth Weblogic web service definition basic RESTful Workspace use instead. If so, how would we implement THIS basic authentication in the definition of Web Service and the Web SErvice reference on the application?

Thank you
Pat

Hello Scott,

Thank you. There is a function for rest in the package:

function make_rest_request(
--
-- This function invokes a RESTful Web service with the supplied name value pairs, body clob, or body blob
-- the response as an clob.
--
-- Arguments:
--   p_url                  The url endpoint of the Web service
--   p_http_method          The HTTP Method to use, PUT, POST, GET, HEAD or DELETE
--   p_username             The username if basic authentication is required for this service
--   p_password             The password if basic authentication is required for this service
--   p_proxy_override       The proxy to use for the request
--   p_body                 The HTTP payload to be sent as clob
--   p_body_blob            The HTTP payload to be sent as binary blob (ex., posting a file)
--   p_parm_name            The name of the parameters to be used in name/value pairs
--   p_parm_value           The value of the paramters to be used in name/value pairs
--   p_wallet_path          The filesystem path to a wallet if request is https
--                          ex., file:/usr/home/oracle/WALLETS
--   p_wallet_pwd           The password to access the wallet
--
    p_url               in varchar2,
    p_http_method       in varchar2,
    p_username          in varchar2 default null,
    p_password          in varchar2 default null,
    p_proxy_override    in varchar2 default null,
    p_transfer_timeout  in number default 180,
    p_body              in clob default empty_clob(),
    p_body_blob         in blob default empty_blob(),
    p_parm_name         in wwv_flow_global.vc_arr2 default empty_vc_arr,
    p_parm_value        in wwv_flow_global.vc_arr2 default empty_vc_arr,
    p_wallet_path       in varchar2 default null,
    p_wallet_pwd        in varchar2 default null ) return clob;

My point was that using the API makes things easier if you have to look for a solution.

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Apress.com/9781430235125
http://Apex.Oracle.com/pls/Apex/f?p=31517:1
http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
-------------------------------------------------------------------

Tags: Database

Similar Questions

  • Basic authentication for the WSDL Web Service for load test

    I am trying to load test a web service; the URL of the WSDL is behind a user name and password using http basic authentication. I can add the URL of the WSDL without problem with the user name and password, but when I read the script, I receive a "401 Unauthorized" errors

    I looked at the preferences > recording > Web Services > the Proxy Configuration, and then refer you to the preferences > recording > HTTP > the Proxy settings. I also looked at similar settings under Preferences > reading.

    I'm running OpenScript (9.1), how to configure it...?

    Thank you very much!

    KM

    Published by: KM 14 Sep, 2011 12:12

    Hello

    You can right click on the section to initialize your script and then:

    Add-> other-> HTTP-> authentication.

    You need 3 parameters:

    A - http://someurl - url that will authenticate any url that contains the http://someurl string for example http://someurl.com/index.html
    A password
    A user

    The following code should be added in your script:

    http.addAuthentication("http://someurl", "username",
                        deobfuscate("5blNah5kX/XuZnepYwInFw=="));
    

    Hope this helps

    Alex

  • Download binary files with the RESTful web service = HTTP 500?

    I want to allow access to the photos (BLOBs) stored in the database via a RESTful APEX service.

    I have an API of PL/SQL existing based on wpg_docload.download_file works well when called directly on the URL (for example granted to APEX_PUBLIC_USER). I would like to re - use this API because it a lot of other things, including security and the cache.

    The code looks like:
    ===
    Photo of procedure (id number, v in varchar2) is
    l_blob blob.
    -- ...
    Start
    -security checks
    -extract the data in l_blob...
    -check if the document has been updated (304)
    -- ...
    owa_util.mime_header (l_mime_type, false);
    HTP.p ("Content-length: ' |") DBMS_LOB.GetLength (l_blob));
    HTP.p ("ETag:" | ") l_etag);
    HTP.p ('Cache-Control: public');
    owa_util.http_header_close;
    wpg_docload.download_file (l_blob);
    end;
    ===

    However, when I call this API with APEX 4.2.1 Restful WebService (the GET - PL/SQL source type resource manager) I get a "500 - internal server error" back to the listener of the APEX (2.0.0.354.17.08 - both running standalone or with Tomcat 7) - console log attached.

    A similar approach - APEX RESTful WebService API in PL/SQL call - works fine for the content of the STRING/CLOB. So it must be something to do with the wpg_docload.download_file

    No idea how to work around this bug/feature or a suggestion for an alternative approach will be appreciated.

    Jan

    -----

    February 28, 2013 21:39:03 oracle.dbtools.rt.web.WebErrorResponse internalError
    SEVERE: ORA-22922: non-existent LOB value

    java.io.IOException: ORA-22922: non-existent LOB value
    at oracle.jdbc.driver.OracleBlobInputStream.needBytes(OracleBlobInputStream.java:204)
    at oracle.jdbc.driver.OracleBufferedStream.readInternal(OracleBufferedStream.java:169)
    at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:143)
    at java.io.FilterInputStream.read (unknown Source)
    to java.nio.channels.Channels$ ReadableByteChannelImpl.read (unknown Source)
    at oracle.dbtools.common.util.StreamCopy.drain(StreamCopy.java:75)
    at oracle.dbtools.common.util.StreamCopy.drain(StreamCopy.java:52)
    at oracle.dbtools.rt.web.ServletResponses.sendResponse(ServletResponses.java:85)
    at oracle.dbtools.rt.web.ServletResponses.sendResponse(ServletResponses.java:130)
    at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:343)
    at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:125)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    to com.sun.grizzly.http.servlet.ServletAdapter$ FilterChainImpl.doFilter (ServletAdapter.java:1059)
    to com.sun.grizzly.http.servlet.ServletAdapter$ FilterChainImpl.invokeFilterChain (ServletAdapter.java:999)
    at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
    at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
    at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    to com.sun.grizzly.util.AbstractThreadPool$ Worker.doWork (AbstractThreadPool.java:532)
    to com.sun.grizzly.util.AbstractThreadPool$ Worker.run (AbstractThreadPool.java:513)
    at java.lang.Thread.run (unknown Source)
    Caused by: java.sql.SQLException: ORA-22922: non-existent LOB value

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:382)
    at oracle.jdbc.driver.T4C8TTILob.processError(T4C8TTILob.java:792)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
    at oracle.jdbc.driver.T4C8TTILob.read(T4C8TTILob.java:146)
    at oracle.jdbc.driver.T4CConnection.getBytes(T4CConnection.java:2435)
    at oracle.sql.BLOB.getBytes(BLOB.java:348)
    at oracle.jdbc.driver.OracleBlobInputStream.needBytes(OracleBlobInputStream.java:181)
    ... more than 33

    Hi Pat,

    problem with the "media resource" has been resolved for APEX listener 2.0.1

    See Re: error APEX listener 2.0.1 Standalone CLOB

    Jan

  • The rESTful Web Service authentication

    I work with Apex 4.2 and Apex listener 2.0 (deployed on WebLogic Server).

    The docs mention OAuth2 but the client requires basic http service authentication.

    Whatever it is, I can't find documentation on how to go about setting up any sort of authentication for a RESTful web service. I have to roll my own or is this something to leave to middleware like Weblogic?

    Any help or pointers would be greatly appreciated.

    Greg

    This seems to be the best answer:

    https://forums.Oracle.com/thread/2464977

  • Integration with the secure web service IS deployed on EBS

    Hello experts,

    I have a REST webservice deployed to an Instance of the EBS. I try to call the web service using a mobile application in the ADF. However, the web service is secure and requires security settings to be sent in the request header.

    Anyone can recall or explain how I can add a custom header to the object of the application for the REST web service? Any help will be appreciated.

    Thank you

    Abhishek

    Hi Abhishek,

    You can do the following:

    String theUsername = "abc";

    String thePassword = "pass";

    String userPassword = theUsername + ': ' + thePassword.

    String encoding = new sun.misc.BASE64Encoder () .encode (userPassword.getBytes ());

    restServiceAdapter.addRequestProperty ("Authorization", "Basic" + coding);

    If you use Webservice DataControl, then automatically the connection information in the login form is injected into the webservice framework.

    Kind regards

    Deepak

  • With parameters rESTful Web services

    Hello

    I'm new to the RESTful Web Services and I have a few problems.  Here's what I've done so far.

    1.) created a web service in SQL workshop area.

    2.) named the User_Test module

    3.) named the model URI User_Test / {Userid} (requires secure access is set to no and format is set to JSON)

    4.) created a query that looks something like this...

    Select field1,

    Field2,

    field3

    from schema.table

    Where user_id =: userid

    5.) created a parameter name and variable binding name are the two "userid".

    Navigated 6) at the following URL:

    _ http://localhost:9091 / apex/app_name/User_Test/1

    The result is:

    {

    [items]

    }

    When I change my steps so that there is no parameter, it works fine.  Any thoughts on what I am doing wrong?

    Thank you

    Brian

    OK, looks like NOT specifying a parameter seems to solve this problem.

  • "I lost the top of my Web page that has"File"Edit etc and the toolbar with the House for 'House' and the arrow of" return to the last page. Does anyone know how to reinstall these? I'm obviously not computer savy.

    Missing once more, the blue band at the top of my Web page that has the file ',' Edit etc and the toolbar with the House for 'Home' and the arrow «back to last page»

    == My grandchildren's play about that.

    Press the Alt key to display the Menu bar, then open view > toolbars and select menu bar and the bar of Navigation, so that they have a check mark.

  • How to stop a Web site generating spams are sent to me - it is all associated with the use of viagra and I had 10 different emails today

    How to stop a Web site generating spams are sent to me - it is all associated with the use of viagra and I had 10 different emails today

    Thank you

    You need to ask the experts of Hotmail one.
     
     
    Help for Windows Live Hotmail can be found in this forum.
    http://answers.Microsoft.com/en-us/windowslive/Forum/Hotmail?tab=all 

    Help for Outlook.com is located in this forum
    http://answers.Microsoft.com/en-us/windowslive/Forum/mail?tab=all
     
  • My msdos program used to run full screen in Windows XP. Now, it occupies the upper third of the screen complete with the rest with scrolling and black.

    My old program MS - Dos ran full-screen in earlier versions of Windows, including earlier versions of Windows XP. Because of something in one of the updates is now the top third only in mode full screen, with the rest of the screen black, white and scrollable (as the Windows XP version of the command prompt has always been). How to return to a usable full-screen version (that is, the previous version of MS-DOS)?

    Hi Robert,.

    Please see the link below for the procedure to correct this problem.

    http://support.Microsoft.com/kb/272447

    Good luck.

  • Service Pack does not have changes to restore it then shuts off and restarts with the same message over and over again.

    Help!  I have an apple mac with windows alongside mac system.  I the have not used for a while and when I logged in the windows system advised me to update to IE 9.  To do this, I had to install Service Pack 2 I did.  He then restarted but cannot install and came up with the following: Service Pack does not have changes to restore it then shuts off and restarts with the same message over and over again.  I don't know what to do to reopen and to reinstall the Service Pack.

    Hello

    This article explains how to troubleshoot problems when you install a service pack for Windows Vista or Windows Server 2008.

    http://support.Microsoft.com/kb/947366

    Use this forum link for all questions related to Windows Vista SP1, Windows Vista SP2 and Windows Server 2008 SP2 below.

    http://social.technet.Microsoft.com/forums/en/itprovistasp/threads

    or repost in the Windows Update forum link below

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-windows_update?page=1&tab=all

  • QUESTION: Can't create a firewall rule to (edge) with the REST API

    Dear Sir

    I am trying to create a firewall rule for simple and basic edge using the REST API.

    I use the REST API guide as a reference on page 158.


    edge-fw-rule.png

    I use the following code (single) in my client REST API (with good content Type (application/xml)):

    < rule >

    < ruleTag > < / ruleTag >

    < name > edge5-rest-rule < / name >

    all < source > < / source >

    < destination > all < / destination >

    < application > all < / application >

    < matchTranslated > true < / matchTranslated >

    < management > in < / direction >

    < action > deny < / action >

    < enabled > false < / enabled >

    < loggingEnabled > true < / loggingEnabled >

    rest-api-rule of the < description > < / description >

    < / rule >

    The error message that I receive is the following:

    <? XML version = "1.0" encoding = "UTF-8"? >

    < error >

    request details invalid <>. Found no match for item rule. < / details >

    < > 223 errorCode < / errorCode >

    < / error >

    The full screenshot of my action REST API is in the screenshot below:

    full-request.png

    Anyone know what I'm doing wrong here?

    Thank you!

    Try this as the body...

    rest-rule

    user

    true

    in

    deny

    fake

    true

    rest-api-rule

  • Connection to vCloud Director 5.1 with the REST api plugin

    vco3.PNGI can't get this to work.

    I'm following part of the manual, I found here: http://blogs.vmware.com/orchestrator/2011/07/vcloud-director-twitter-yahoo-and-foursquarecom-http-rest-plug-in-use-case-examples.html

    So I install the plugin and run the workflow to add a host:

    vco1.PNG

    And set the authentication with the workflow "Set vCloud to authenticate a host REMAINS:

    vco2.PNG

    And run the supplied workflow "show a vCloud, Director of the Organization:

    vco3.PNG

    And get the error: "no valid API version can be selected.

    I also tried with version 1.0 and 1.5 of putting in the URL, but cannot make it work. What Miss me?

    Thank you.

    Hello

    It is a problem with you REST plugin does not support the vCloud 5.1 authentication correctly.

    I created the following work around to fill the gap until a new version of the plugin REST solves this problem.

    Please find here.

    Christophe.

  • Firefox is compatible with the window Surface Pro and Win Phone 8

    Firefox is compatible with the window Surface Pro and Win Phone 8

    A user has posted here the other day that uses a Surface Pro 2 with Windows 8.1, then it should work basically the way it works on a desktop or laptop computer.

    Windows Phone, I don't think.

  • I don't want flash cookies removed with the rest of the cookies.

    Either an update with firefox or adobe flash player now couples cookies flash with the rest. I like to have my associate internet cookies clear after closing the browser to help save space and destroy what is malicious, but do not want to have my flash game data get allowed in the process. I checked the Security tab in the options, but he doesn't seem to be a way to specify for cookies flash to stay safe and sound; There delete all cookies or delete cookies. Is it possible to have my cookie and eat, too?

    Let the cookies expire when you close Firefox instead of using Delete browsing, search and download history on Firefox.

  • What value for p_print_server when you use the Rest Data Services as a print server?

    Hello

    I have my report server on the internal workspace defined as BI Publisher URL as default... It works for my BI Publisher reports.

    I have 2 reports who need to use the rest Data Services FOP engine and use GET_PRINT_DOCUMENT function Signature 4

    https://docs.Oracle.com/CD/E59726_01/doc.50/e39149/apex_util.htm#AEAPI146

    For these 2 reports, I need to pass a parameter to p_print_server. The documentation describes this as the URL for the print server

    My question is, how to find the URL for p_print_server when I want to use the rest Data Services FOP on ADR?

    I can not put as NULL as at the time, it will use the default BI Publisher URL and then these 2 reports will not work

    Moreover, when I put the server reports on internal workspace as 'Rest Data Services', my two reports work fine, but not when I put is as URL BI Publisher - which is necessary

    Help, please

    Concerning

    Matt

    Hi Matt Mulvaney,

    Matt Mulvaney says:

    I already have the correct configuration to be able to produce reports FOP including two steps you mentioned. This set works very well when I put the "Print server" preference in the settings of APEX Data Services Instance remains - and reports can be produced. But as I said, this must be set to a URL of BI Publisher.

    If you use "Print server" as "Oracle BI Publisher" then the p_print_server parameter would have been:

    http://myserver.mydomain.com:8888/xmlpserver/convert

    Where:

    • Printing of the address of the host server: myserver.mydomain.com (you can also use the IP address)
    • Print Server Port: 8888 (depending on what your BI Publisher Server uses port)
    • Print server script: / xmlpserver/convert

    Similarly, if you choose "Print server" as 'Oracle REST Data Services', the instance settings don't ask questions on the print settings, but internally it uses the following parameters and the p_print_server parameter is:

    http://myserver.mydomain.com:8080 / ADR / _ / fop2pdf

    Where:

    • Printing of the address of the host server: myserver.mydomain.com (host computer on which ADR is hosted)
    • Print Server Port: 8080 (the port used by what ADR/APEX Forum)
    • Script of the print server: / ords / _ / fop2pdf (this is not disclosed by APEX/ADR documentation, but as mentioned by Marc Sewtz in the following thread)

    Reference: Re: Apache FOP disappeared by Oracle APEX installable APEX 5.0 and 5.0.1 APEX

    Kind regards

    Kiran

Maybe you are looking for