Calling Portal APIs from Apex

I have posted this on the application express forum as well, not sure who will come up with the answer, so here is my question anyway.
I am trying to call the portal.wwsec_api from within an apex application. The application is parsed using the portal schema so has all the correct grants by default.
The code I am using is:
declare
l_person_rec wwsec_person%rowtype;
begin
l_person_rec := wwsec_api.person_info
p_user_name => 'PORTAL'
:P3_USER_INFO:=l_person_rec.user_name || l_person_rec.first_name;
exception
when others then
:p3_user_info:=sqlerrm;
end;
This code (minus the item references) runs fine in sqlplus, but errors when I run it in apex. I have narrowed it down to the api that is erroring as I can access the table direct.
Can anyone help with this?
Thanks

I have now solved this problem. If you want to access portal apis from apex you need to set a portal context like this:
portal.wwctx_api_private.set_context( p_user_name => 'portal'
, p_password => 'portal');
This shouldn't impact security as the value of p_password does not have to be your schema password it can be set to anything.

Similar Messages

  • Callin Portal APIs from Apex

    I am trying to call the portal.wwsec_api from within an apex application. The application is parsed using the portal schema so has all the correct grants by default.
    The code I am using is:
    declare
    l_person_rec wwsec_person%rowtype;
    begin
    l_person_rec := wwsec_api.person_info
    p_user_name => 'PORTAL'
    :P3_USER_INFO:=l_person_rec.user_name || l_person_rec.first_name;
    exception
    when others then
    :p3_user_info:=sqlerrm;
    end;
    This code (minus the item references) runs fine in sqlplus, but errors when I run it in apex. I have narrowed it down to the api that is erroring as I can access the table direct.
    Can anyone help with this?
    Thanks

    More info for anybody looking at this.
    I have tried prefixing the api with portal, that didn't work. The code handles the exception and gives me the amazingly helpful 'User-Defined Exception' error message. I also tried creating my own procedure within the portal schema that calls the api, this executes when run from sqlplus, but again not from apex. If I replace the api calls in the procedure with simple select stuff and then call the procedure from apex it works fine.
    So my code in the procedure on the database (in portal schema) looks like this
    create or replace procedure get_user_info(pa_user_name wwsec_person.user_name%type,
    op_first_name out wwsec_person.first_name%type) IS
    l_person_rec wwsec_person%rowtype;
    --l_test varchar2(256);
    begin
    l_person_rec := wwsec_api.person_info ( p_user_name => pa_user_name );
    /*select user_name into l_test
    from wwsec_person
    where user_name = pa_user_name;*/
    op_first_name:=l_person_rec.first_name;
    exception
    when others then
    raise;
    end;
    show errors
    I have granted execute on this procedure to apex_public_user
    My code in apex that calls this procedure looks like this
    declare
    l_first varchar2(256);
    begin
    get_user_info('HANNAH', l_first);
    :P3_USER_INFO:= l_first;
    exception
    when others then
    :P3_USER_INFO:=sqlerrm;
    end;
    I am running out of ideas now, so any help would be appeciated.
    This is the output from sqlplus when I run the code as apex_public_user
    variable apextest varchar2(256)
    execute portal.get_user_info('HANNAH', :apextest);BEGIN portal.get_user_info('HANNAH', :apextest); END;
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1803
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1637
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1922
    ORA-06512: at "PORTAL.WWCTX_API", line 279
    ORA-06512: at "PORTAL.WWERR_API_ERROR", line 99
    ORA-06512: at "PORTAL.WWERR_API_ERROR", line 222
    ORA-06512: at "PORTAL.WWSEC_API_PRIVATE", line 5550
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1803
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1637
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "PORTAL.GET_USER_INFO", line 19
    ORA-06512: at line 1
    spool offThanks

  • Calling Portal event from ABAP class

    Hi Experts,
    I need a following clarificatrion, Please help,
    1. Is it possible to call a webdynpro method from a normal ABAP class?
    2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    3. Is there any ways with which we can call portal event from ABAP class?
    Thanks,
    Shabir

    >1. Is it possible to call a webdynpro method from a normal ABAP class?
    I wouldn't necessarily recommend this approach. You shouldn't try to trigger events or any of the standard WDDO* methods from outside the WD Component itself.  That said, you can pass the object reference (like the WD_COMP_CONTROLLER object reference or the View Object Reference) into methods of normal classes.  Be careful if you are finding yourself calling a lot of your added methods from outside WD.  This is probably a sign that these methods should be in the Assistance Class or some other Class functioning as a Model Object.
    >2. If no, we need a functionality of a class 'CL_WDR_HTTP_EXT_MIME_HANDLER' having method 'DO_DOMAIN_RELAX_HTML'.
    Is there any alternative method which can be used in ABAP having the same functionality.
    What exactly do you want to do here?  Do you just want to get the relaxation script?  For what purpose?  You should never need to inject the relaxation script into WDA. 
    >3. Is there any ways with which we can call portal event from ABAP class?
    To what purpose.  Do you just want to delegate the triggering of the event that is inside WD Component to be called from a class?  If so you can pass the portal API object reference into a class from the WD Component.  However this only works while running within WD.
    How is this class used?  Are you running in WD?  Are you trying to generate some HTML code that runs in the portal independent of WD?

  • Calling Java API from ABAP using JCo (Part 2)

    Hello,
    This is an additional question to thread Calling Java API from ABAP using JCo
    Has anyone managed to get the input parameter value
    input.getString("REQUTEXT")
    that is being passed from ABAP?
    If yes, what kind of setting you need to do? Because when I execute, it has no value.
    Thus, the below ECHOTEXT parameter returns blank value:
    output.setValue(input.getString("REQUTEXT"),"ECHOTEXT");
    When I debug by printing the below line, the input XML is indeed without value:
    System.out.println(input.toXML());
    Anybody knows how to pass input variable from ABAP to JAVA using JCo?
    rgs,
    hiroshi

    Hallo Hiroshi,
    as far as I can see, you are doing it the right way. The problem might be that the ABAP program does not fill in this parameter because something went wrong in the SAP System.
    Have you tried setting a breakpoint (an HTTP session - remote breakpoint) and tried checking step by step if the value is being processed and put into the REQUTEXT field?
    Bye,
    Sameer

  • Calling Java API from ABAP using JCo

    I need to call Java API from ABAP & BSP also. For this I have got useful information related to JCo from following blog:
    /people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection
    But, I am facing one problem. On executing Java program myExample5.java (recommended by Gregor Wolf) from command line I get following error message:
    Server JCOSERVER01 changed state from [ STOPPED ] to [ STARTED ]
    Exception in server JCOSERVER01:
    com.sap.mw.jco.JCO$Exception: (129) JCO_ERROR_SERVER_STARTUP: Server startup failed at Thu Apr 26 13:46:32 IST 2007.
    This is caused by either a) erroneous server settings, b) the backend system has
    been shutdown, c) network problems. Will try next startup in 1 seconds.
    Connect to SAP gateway failed
    Connect_PM  TPNAME=JCOSERVER01, GWHOST=gateway, GWSERV=3300
    LOCATION    CPIC (TCP/IP) on local host
    ERROR       hostname 'gateway' unknown
    TIME        Thu Apr 26 13:46:32 2007
    RELEASE     640
    COMPONENT   NI (network interface)
    VERSION     37
    RC          -2
    MODULE      ninti.c
    LINE        336
    DETAIL      NiPGetHostByName2: hostname 'gateway' not found
    SYSTEM CALL gethostbyname_r
    COUNTER     1.
    Can anyone please help me out. Do I need to do any setting?
    I'll surely reward points.
    Thanks & Regards,
    Nilesh Kumar

    Hi Nilesh,
    From the error i think that the error is with the hostname.
    Please enter the the Application Server IP/Hostname.
    If you are loggin to SAP System "XX1" from SAP GUI. Then click the change Item tab and see Application server name/IP let say "XX2" for hostname or "xx.xx.xx.xx" for IP.
    Replace <i>srv[0] = new Server("gateway","sapgw00","JCOSERVER01",repository);</i>
    with <i>srv[0] = new Server("XX2","sapgw00","JCOSERVER01",repository);</i>
    If App Server is IP then replace with
    <i>srv[0] = new Server("xx.xx.xx.xx","sapgw00","JCOSERVER01",repository);</i>
    Let me know if it is throwing any error.
    Thanks,
    Prashil

  • Calling portal service from web service

    Hello,
    I'm trying to call portal service from web service. Is this possible? I'm getting an error.
    For example, code:
    IJCOClientService clientService = (IJCOClientService) PortalRuntime.getRuntimeResources().getService(IJCOClientService.KEY);
    .. is generating exception:
    java.lang.LinkageError: Class com/sapportals/portal/prt/runtime/IPortalRuntimeResources violates loader constraints
    Do anybody knows what's wrong?
    Best regards,
    Josef Motl

    Hi Josef,
    Is the IJCOClientService located on the producer side or on the consumer side?
    Amit

  • How to call Java API from BSP?

    I have a requirement to call Java API from BSP application.
    I have checked the forum and found that it is possible by using some ABAP codes.
    However there is no pointer on how this is done.
    Can someone explain the details on how to call Java API from BSP is done?
    I found class CL_EJB_JAVA_OBJECT_METHODS to call a method in EJB but can't find function or SAP class to call Java API.
    Actually is there any BSP extention which can used to call Java API?
    Thanks,
    Hendri

    check out these weblogs, it should give you an idea how to go about it.
    /people/ignacio.hernndez/blog/2006/12/04/speech-synthesis-listen-the-application-server-is-talking-to-you
    /people/puru.govind/blog/2006/12/20/let-abap-speak
    Regards
    Raja

  • Re: Calling Windows API from Tool

    Hi,
    If it's only for the UserName on NT you can get the environment variable
    USERNAME.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Url : http://perso.club-internet.fr/dnguyen/
    Tim Sawyer a &eacute;crit:
    Hi George,
    I think you need to find out which Windows DLL implements the function and
    then wrapper it, using Fort&eacute;'s C Wrappering technique. I'm going to be
    doing this for the GetUserName() function, so we can login to our
    application automatically, using the username that the user logged into NT
    with.
    Hope this helps!
    Tim Sawyer
    PanCredit
    Leeds, UK.
    From: Aberdour George <[email protected]>
    Date: Thu, 6 May 1999 09:08:03 +1000
    Subject: Calling Windows API from Tool
    Hi,
    Does anyone know how to call Windows API calls such as WinExec,
    CreateProcess, RegSetValue, etc directly from TOOL ?
    These are just examples calls. I know some Windows API calls can be called
    via equivalent OperatingSystem method calls, but I would really like toknow
    if it is possible to call Windows API routines directly.
    Thanks in advance,
    George Aberdour
    TAFE NSW-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    I'm afraid we have to make it work for NT, 95 and probably 98 too, so we're
    looking for something a bit more robust than the environment variable.
    Thanks,
    Tim Sawyer
    PanCredit
    Leeds, UK.
    From: Daniel Nguyen[SMTP:[email protected]]
    Reply To: [email protected]
    Sent: 07 May 1999 20:40
    To: Tim Sawyer
    Cc: '[email protected]'; '[email protected]'
    Subject: Re: Calling Windows API from Tool
    Hi,
    If it's only for the UserName on NT you can get the environment variable
    USERNAME.
    Hope this helps,
    Daniel Nguyen
    Freelance Forte Consultant
    Url : http://perso.club-internet.fr/dnguyen/
    Tim Sawyer a &eacute;crit:
    Hi George,
    I think you need to find out which Windows DLL implements the functionand
    then wrapper it, using Fort&eacute;'s C Wrappering technique. I'm going to be
    doing this for the GetUserName() function, so we can login to our
    application automatically, using the username that the user logged intoNT
    with.
    Hope this helps!
    Tim Sawyer
    PanCredit
    Leeds, UK.
    From: Aberdour George <[email protected]>
    Date: Thu, 6 May 1999 09:08:03 +1000
    Subject: Calling Windows API from Tool
    Hi,
    Does anyone know how to call Windows API calls such as WinExec,
    CreateProcess, RegSetValue, etc directly from TOOL ?
    These are just examples calls. I know some Windows API calls can be
    called
    via equivalent OperatingSystem method calls, but I would really like toknow
    if it is possible to call Windows API routines directly.
    Thanks in advance,
    George Aberdour
    TAFE NSW-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • How to call remote API from root SharePoint 2013 domain (not an app)

    I'm trying to follow the article
    http://msdn.microsoft.com/en-us/library/office/fp179895%28v=office.15%29.aspx
    For a SharePoint 2013 hosted under O365, do I need to create an app to use the SP.* methods in sp.js? I need to call a remote API from the root domain (https://mycompany.sharepoint.com). But the app, as mentioned in the article
    above, deploys on a whole different URL (https://mycompany-a2d3f4t454.sharepoint.com).
    I need to be able to call the API from pages like https://mycompany.sharepoint.com/pages/default.aspx. Is this not possible?

    Hi,
    According to your description, my understanding is that you want to call remote API from the root domain site.
    Yes, you can use SharePoint hosted app to achieve it. SharePoint hosted app has app web and host web, you can create an app to call the remote api in the host web from app web.
    Here are some detailed articles for your reference:
    http://blog.ctp.com/2014/06/23/data-access-in-sharepoint-hosted-apps/
    http://msdn.microsoft.com/en-us/library/office/fp179925(v=office.15).aspx
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Calling HRMS APIs from a DotNet plateform

    Hello,
    I am new on this forum and I have difficulty in beginning, i don't know if it's the right category to post my question.
    I'm working in a project looking for a solution of revision of the self-service's interfaces of oracle e-business suite, indeed I need an example or a document which can help me for using the HRMS APIs of oracle e-business suite via a dotNet plateform or SharePoint application.
    I have to work on a middelware allowing retreiving and persisting data from oracle e-business suite database using oracle HRMS APIs like hr_appraisals_api. So haw can i call these APIs from .NET application how can i use a .NET code to call these api's ?
    Can you help me please ? i'm waiting for your answers if possible and this is my e-mail address if necessary "[email protected]" .
    I would be so grateful if someone can help me. Thank you in advance.
    Cordially.

    HRMS PLSQL API can be called from Java and .Dot net support to execute Java API . This way it could be done.
    I have not idea how call PLSQL API from direct .Dot net code.
    Thanks

  • Calling a Macro from APEX

    Hi all,
    after seeking on the forum and internet, I'm writing you my goal to see if you can guide/help me.
    I'm using APEX 3.2 for uploading some excel sheets. After looking for info, we figured out that xls cannot be uploaded, so we asumed we need to upload the files in CSV format. The problem is that the user does not want to go every time they want to upload a file to "Save as...CSV", so we decided to do a macro in Excel that will change the format for him.
    So, my goal is to run this macro from the APEX app right before the user uploads the file, the most invisible way for the user as possible.
    The flow would be something like this:
    Load the page of the application.
    Run the macro from javascript maybe??
    Change the format in local drive of the user, from XLS to CSV.
    The user will use the file browser in the app and choose the CSV format from his local drive and upload it.
    Has anyone have any ideas on how to do this? I have tried calling a batch from apex that creates a file, but I get a permission error, I guess because of security issues.
    Thanks a lot!

    You can NOT call an Excel macro directly from APEX.. Reason being the browser PROTECTS you from malicious code that COULD be run on your local machine this way..
    Here is a Windows command script that your user can run, or you can setup to run every night for them.. Change the getfolder call with the proper directory..
    Dim oFSO
    Dim oShell, oExcel, oFile, oSheet
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set oShell = CreateObject("WScript.Shell")
    Set oExcel = CreateObject("Excel.Application")
    oExcel.DisplayAlerts = False
    For Each oFile In oFSO.GetFolder("C:\").Files
      If LCase(oFSO.GetExtensionName(oFile)) = "xls" Then
        With oExcel.Workbooks.Open(oFile, 0, True, , , , True, , , , False, , False)
          For Each oSheet In .Worksheets
            oSheet.SaveAs ".\" & oFile.Name & "." & oSheet.Name, 6
          Next
          .Close False, , False
        End With
      End If
    Next
    oExcel.Quit
    oShell.Popup "Conversion complete", 10Thank you,
    Tony Miller
    Dallas, TX

  • Calling java APIs from a function module

    Hi,
    Can someone tell me whether it is possible to call Java APIs from a function module in SAP system?
    Thanks in advance,
    Vineetha

    Hi,
    I guess you have changed the properties of screen only.
    I assume you have made a Ztransaction Code.
    When you define a transaction code, you need to specify a screen number for radio option program and screen and you need to specify a screen and not subscreen.( I think so!!)
    You changed only the code without changing the transaction code properties.
    Therefore, i think u r getting a dump.
    If you want to call your subscreen, call it in some screen and then call that screen using your transaction code properties.
    To include a subscreen screen in the subscreen area of the main screen and call its PBO flow logic, use the following statement in the PBO event of the main screen:
    PROCESS BEFORE OUTPUT.
      CALL SUBSCREEN <area> INCLUDING <prog> <dynp>.
    To call the PAI flow logic of the subscreen screen, use the following statement in the PAI flow logic of the main screen:
    PROCESS AFTER INPUT.
    CALL SUBSCREEN <area>.
    Refer:
    http://help.sap.com/saphelp_webas630/helpdata/en/9f/dbabfe35c111d1829f0000e829fbfe/content.htm
    Regards,
    Tanveer.
    Please mark helpful answers.
    Message was edited by: Tanveer Shaikh
    Message was edited by: Tanveer Shaikh

  • How to call SOAP API from JavaScript

    Hi,
    I'm trying to call the SOAP API to get statistics about emails. Are there any examples on how to call the API from JavaScript?
    Here is a link to my original question about using the REST API. REST API URL for email statistics
    Thanks,
    Tim

    Tim,
    In order to consume a SOAP API I recommend you use something other than JavaScript.
    Any platform can offer you a good SOAP client should be OK. (.Net, Java, php, Ruby, python).
    I didn't see anyone successfully used javascript and consume the Eloqua SOAP API.
    I know you can create a SOAP client in Java script but it will be too much work to handle the Eloqua response in some cases.
    Regards,
    Daniel

  • Regarding tutorial of how to call Oracle Reports from APEX

    Hi,
    I'm trying to call Oracle Reports from APEX using this tutorial.
    http://www.oracle.com/technology/products/database/application_express/howtos/howto_integrate_oracle_reports.html
    But in the step of 'Create the Oracle HTML DB Application', 'OE' doesn't appear in the LOV of Existing Schema, even though the sample schema exists in the schema and they are unlocked. And when I type 'OE' directly without using LOV, and press Next, the message 'Schema is reserved or restricted' appears.
    How can I create the workspace based on OE schema?

    Hello Shohei,
    I know your following the tutorial, but if you want to call oracle reports from apex it is quite easy though if your working with oracle reports 9i or higher. Just create an html region and put in the source the html code for referencing an url like to_report
    Or reference the same url from a button placed on the HTML region
    (you can create a package that would create the whole URL and returns it as a string, easier for scalability)
    Hope this can help you to (tutorial is good but try and learn from scratch is also good ;-) )
    Erwin

  • How to call Oracle Reports from APEX

    Dear All,
    I am new to APEX. My first job assignment is "calling oracle reports from apex".
    Can any one help me on this? Is there any online examples / tutorials from OTN site?
    TIA.

    Hi Joe,
    the how-to is still valid for APEX 3.0. Calling an Oracle Report from APEX is still the same, it's basically the URL you build for the report call and Oracle Reports hasn't changed that format.
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

Maybe you are looking for

  • How to remove tv card from touchsmart 610_1010

    The tv card in my touchsmart 610_1010 as stopped working the device manager says it is working and I've uninstalled it and reinstalled but the media centre says it cann,t detect tv tuner ' I was thinking of doing a card removal and reinstall , can an

  • 3.12 Bug with WiFi and non broadcast SSID?

    I seem to have a bug. I can reliably replicate this on my phone and after talking to others, they mention the same issues. Setup: WiFi that does not broadcast its SSID and is protected (could be any protection, mine happens to use WPA Enterprise) How

  • Can't make phone calls on i6

    Initiated my new i6 after backing up from my 5c. When I try to make a phone call now I'm automatically redirected to an outside operator that's going to require me to use a credit card to make my call. Under Settings when I go to Phone it says my Pho

  • Ally & Email (again!)

    Yesterday morning, my email stopped working.  At first it was my exchange email (which just disappeared), and then my POP3 email kept doing a "force close" routine.  I called the tech support people at Verizon, and then directed me to do a factory re

  • For HP experts: sound Mic/headphone problem with presario c350ea

    Hi there, I'm facing a trouble with my laptop microphone system hope someone help me to resolve this issue, I bought Compaq Presario c350 ea in 2007 and its work very well till now and I am happy with it, couple of weeks ago, FIRST time I plug in hea