Validations when we use GET method

Hi Team,
I am using GET method with the following URL(example)
http://IP:8080/ords/schema_name/office/users/{user_id}
URI template : office/users/{user_id}
method:get
source type : Feed
Source : select * from emp where empno = :user_id;
Using the above URL I am able to get all the specified user details in the browser.
I want to add the validations to the service now, and response should be user defined.
Ex : when user not in the database
then respond with the error code and error name in JSON format ex:
items:
error code : 404
message: "somthing wrong"
I am not sure how we can achieve this functionality when we use SQL query.
Please suggest any possible solutions for this.
thanks
Chandran

grant dba_users view to apex and change the sql like this:
select * from emp where empno = :user_id and exists (select 1 from dba_users where username=:user_id);

Similar Messages

  • [svn:fx-trunk] 10891: Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants

    Revision: 10891
    Author:   [email protected]
    Date:     2009-10-06 09:46:47 -0700 (Tue, 06 Oct 2009)
    Log Message:
    Fix for ASDoc throws error when using getter methods for pseudo-inheritance of static constants
    QE notes: None.
    Doc notes: None
    Bugs: SDK-22676
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22676
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/asdoc/AsDocUtil.java

    Have you tried using com.adobe.air.crypto.EncryptionKeyGenerator instead?

  • Problems using GET method in JSP

    Hi,
    I had some problems using GET method in JSP.
    I'm using Apache web server 1.3 and Tomcat 3.3.1 in windows 2000.
    And I'm using language English and Korean.
    When I send messages using POST method, all is good
    But when I send message using GET method, English is good, but Korean is not good.
    I tried to encode using
    URLEncode.encode(str, "UTF-8")
    and decoding it using
    URLDecode.decode(request.getParameter(tag), "UTF-8")
    but it didn't work.
    How can I receive request including Korean using GET method in JSP?
    If anyone have solutions, please let me know.
    thanks.

    Hi,
    I had some problems using GET method in JSP.
    I'm using Apache web server 1.3 and Tomcat 3.3.1 in
    windows 2000.
    And I'm using language English and Korean.
    When I send messages using POST method, all is good
    But when I send message using GET method, English is
    good, but Korean is not good.
    I tried to encode using
    URLEncode.encode(str, "UTF-8")
    and decoding it using
    URLDecode.decode(request.getParameter(tag), "UTF-8")
    but it didn't work.
    How can I receive request including Korean using GET
    method in JSP?
    If anyone have solutions, please let me know.
    thanks.This problem appears, when one use UTF-16 encoding in JSP - am I right?
    If so there are two solutions:
    1) Temporary: Use "UTF-8" - or any other 8 bit encoding scheme and
    encode Korean symbols with "&1234;" kind of escapes - though it
    may not work
    2) Absolute: get my piece of code, which I have managed to write
    just a month ago resolving absolutely similar problem with UTF-16
    in code using Chinese/Russian/English encodings
    But I wouldn't say that it's costs 10 DDs :) - it's much more
    expensive... So try 1st variant if it wouldn't help - let me know.
    I'll figure :)
    Paul

  • When we use setHeader() method??

    hi,
    when we use setHeader() method??

    Hello,
    I need to place some parameters in a header and send the others as
    a body. However when i try to place some in a header i get error.
    This is the code of the CLIENT:
    Header header=new Header();
    Vector params = new Vector ();
    params.addElement (new Parameter("UserName", String.class,
    "xxx", Constants.NS_URI_SOAP_ENC));
    (...) <-- other params (similar as the one above)
    header.setHeaderEntries(params);
    // build the call.
    Call call = new Call();
    call.setSOAPTransport(st);
    call.setSOAPMappingRegistry (smr);
    //"urn:xmethods-Temperature" (below--> for the temperature thing
    call.setTargetObjectURI("https://www.creditinform.no/creditinform
    .standardwebservice.ws2005207/InfoXML");
    call.setMethodName("HitListPerson");
    call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encodin
    g/");
    call.setHeader(header);
    And i get the following error:
    java.lang.ClassCastException: org.apache.soap.rpc.Parameter
    at org.apache.soap.Header.marshall(Header.java:134)
    at org.apache.soap.Envelope.marshall(Envelope.java:197)
    at org.apache.soap.Envelope.marshall(Envelope.java:162)
    at
    org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnect
    ion.java:354)
    at org.apache.soap.rpc.Call.invoke(Call.java:261)
    Any sugestion could be helpfull.
    Thank you for your time,
    C.E.

  • How to close parent window when we use call method l_window_manager- create

    hi...
    how to close parent window when we use call method l_window_manager->create_external_window
    thank you.

    hi
    good
    go through this link,hope this ll help you to solve your problem
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/63a47dd9-0b01-0010-3d8e-de27242bf011
    thanks
    mrutyun^

  • NullPointerException thrown when using get method in CMR relationship outsi

    We are using weblogic 9.1 CMP entity beans with BEA's XA oracle driver. We have a bean called User that has a many address beans. When calling the getAddresses method on a UserLocal a NullPointerException gets thrown if the stateless session bean method that is marked as @LocalMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS). If we change it to REQUIRED the method returns addresses successfully. Does anyone have any ideas as to what could be causing this? Below is the stack trace.
    My best guess is that an exception is occurring and when weblogic tries to handle the exception EJBRuntimeUtils.throwEJBException encounters the NullPointerException.
    javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.<init>(echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.java
    :93)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS.getAddresses(echo_user_User_l47u68__WebLogic_CMP_RDBMS.java:1161)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68_ELOImpl.getAddresses(echo_user_User_l47u68_ELOImpl.java:770)
    at gov.nasa.echo.subsystems.user.UserTypeMap.convertUser(UserTypeMap.java:66)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUserByUserId(UserSubsystem.java:321)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUsersByUserId(UserSubsystem.java:302)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean.login(AuthenticationServiceBean.java:442)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean_plcr77_ELOImpl.login(AuthenticationServiceBean_plcr77_ELOImpl.java:1001)
    at gov.nasa.echo.v8.AuthenticationServicePortImpl.login(AuthenticationServicePortImpl.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    ; nested exception is: java.lang.NullPointerException
    at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:643)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:604)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:347)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
    Truncated. see log file for complete stacktrace

    Jason Gilman wrote:
    We are using weblogic 9.1 CMP entity beans with BEA's XA oracle driver. We have a bean called User that has a many address beans. When calling the getAddresses method on a UserLocal a NullPointerException gets thrown if the stateless session bean method that is marked as @LocalMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS). If we change it to REQUIRED the method returns addresses successfully. Does anyone have any ideas as to what could be causing this? Below is the stack trace
    My best guess is that an exception is occurring and when weblogic tries to handle the exception EJBRuntimeUtils.throwEJBException encounters the NullPointerException.
    Open an official support case. This has nothing to do with jdbc.
    Joe
    >
    >
    javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.<init>(echo_user_User_l47u68__WebLogic_CMP_RDBMS_addresses_Set.java
    :93)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68__WebLogic_CMP_RDBMS.getAddresses(echo_user_User_l47u68__WebLogic_CMP_RDBMS.java:1161)
    at gov.nasa.echo.dataaccessobjects.user.echo_user_User_l47u68_ELOImpl.getAddresses(echo_user_User_l47u68_ELOImpl.java:770)
    at gov.nasa.echo.subsystems.user.UserTypeMap.convertUser(UserTypeMap.java:66)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUserByUserId(UserSubsystem.java:321)
    at gov.nasa.echo.subsystems.user.UserSubsystem.getUsersByUserId(UserSubsystem.java:302)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean.login(AuthenticationServiceBean.java:442)
    at gov.nasa.echo.services.authentication.AuthenticationServiceBean_plcr77_ELOImpl.login(AuthenticationServiceBean_plcr77_ELOImpl.java:1001)
    at gov.nasa.echo.v8.AuthenticationServicePortImpl.login(AuthenticationServicePortImpl.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at weblogic.wsee.component.pojo.JavaClassComponent.invoke(JavaClassComponent.java:91)
    at weblogic.wsee.ws.dispatch.server.ComponentHandler.handleRequest(ComponentHandler.java:68)
    at weblogic.wsee.handler.HandlerIterator.handleRequest(HandlerIterator.java:127)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:84)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:60)
    at weblogic.wsee.server.servlet.SoapProcessor.handlePost(SoapProcessor.java:66)
    at weblogic.wsee.server.servlet.SoapProcessor.process(SoapProcessor.java:44)
    at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:124)
    at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:53)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:127)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:272)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3153)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1973)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1880)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1310)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    ; nested exception is: java.lang.NullPointerException
    at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:141)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:643)
    at weblogic.ejb.container.internal.BaseLocalObject.handleSystemException(BaseLocalObject.java:604)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:347)
    at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
    Truncated. see log file for complete stacktrace

  • When to use GET LATE command in LDB

    Hi,
    Can anyone tell me the the use of GET LATE command in logical database,
    when to use this..
    example will be more helpful.
    Regards,
    Mrunal

    Hi Frd
            If you want to perform calculations or other operations which are not associated with certain additional fields, you can formulate ABAP code for the GET and GET LATE events of a logical database table when creating an InfoSet. The code for GET events is particularly important if you have defined parameters or selection criteria for the InfoSet. It is here that you must define the code to check whether a table line is to be evaluated or not.
    Example
    REPORT demo_program_get_late.
    NODES: spfli, sflight, sbook.
    DATA weight TYPE i VALUE 0.
    START-OF-SELECTION.
      WRITE 'Test Program for GET node LATE'.
    GET spfli.
      SKIP.
      WRITE: / 'Carrid:', spfli-carrid,
               'Connid:', spfli-connid,
             / 'From:  ', spfli-cityfrom,
               'To:    ', spfli-cityto.
      ULINE.
    GET sflight.
      SKIP.
      WRITE: / 'Date:', sflight-fldate.
    GET sbook.
      weight = weight + sbook-luggweight.
    GET sflight LATE.
      WRITE: / 'Total luggage weight =', weight.
      ULINE.
      weight = 0.
    Reward Me Point
    By
    Pari

  • Using get method on hashtable

    I have built two hashtables and populated them with my data, but now I need to get the key from one table and see if it exists in the other, I've seen the get method in the api but I can't understand how to use it? Could someone show me a simple example of how to use the get method?

    kajbj wrote:
    Do you have Hashtable or HashMap or a datastructure of your own? They're both Hashtables:
         Hashtable<String, String> activeData;
         Hashtable<String, String> passiveData;I've written this piece of code, not tested it yet though:
         public void doComparison(Hashtable<String, String> activeData, Hashtable<String, String> passiveData)
              Enumeration<String> e = activeData.keys();
              Enumeration<String> f = activeData.elements();
              while (!activeData.isEmpty())
                   activeData.get(e);
                   if (passiveData.containsKey(e))
                        //Keys match, now check data
                        activeData.get(f);
                        if (passiveData.containsValue(f))
                             //Both key and value matched
                             passiveData.remove(e);
                             passiveData.remove(f);
                             activeData.remove(e);
                             activeData.remove(f);
                        else
                             //The keys matched, but the data linked to them did not
                             //Call the output class here
                             passiveData.remove(e);
                             passiveData.remove(f);
                             activeData.remove(e);
                             activeData.remove(f);
                   else
                        //Keys did not match, output the differences
                        //Call the output class here
                        passiveData.remove(e);
                        passiveData.remove(f);
                        activeData.remove(e);
                        activeData.remove(f);
         }Edited by: jnaish on Aug 15, 2008 1:53 AM

  • When to use join method

    Hi,
    recently i have been studying Threading, and quite fascinated by it. however i am struggling to understand in what circumstance a programmer will be using a join method on a thread.
    what i understand from reading docs is, if i call join() on a thread "thread1", then whenever this call happens the "current thread" will stop its execution till "thread1" finishes its execution i.e. DIE.
    when code is executing no one has control over which thread will be the current thread when the join is called.
    can someone please explain with a real life scenario?
    Thanks in advance

    recently i have been studying Threading, and quite fascinated by it. however i am struggling to understand in what circumstance a programmer will be using a join method on a thread.
    what i understand from reading docs is, if i call join() on a thread "thread1", then whenever this call happens the "current thread" will stop its execution till "thread1" finishes its execution i.e. DIE.
    There are plenty of examples and documentation on the internet about multithreading and the use of 'join'.
    As the doc quote suggests, and at the risk of stating the obvious, it is used when you want a thread to stop its own execution until another thread has finished its own execution.
    That is a form of 'serialization' that ensures that certains steps of a process are done in a desired order.
    The generic 'multi-threading' use case is that the threads can executing in parallel and have NO dependencies on each. For example, 10 threads each loading a specific file into the database.
    But there are times when one process is dependent on another. Rather than bind those two processes together (e.g. by using method calls from within a single thread) a more modular approach is to launch each process in a thread but cause the second process to wait, using 'join', until the first process/thread has completed.
    when code is executing no one has control over which thread will be the current thread when the join is called.
    I have NO IDEA what that even means.
    Again, stating the obvious, a thread can NOT execute the 'join' method unless that thread is active so if that thread is active is IS the 'current' thread. When it executes the 'join' it will be suspended until the 'joined' thread terminates. The thread that it is 'joining' may not become 'active' right away and it make take several thread rotations before it completes execution and reactivates the thread that 'joined' it.

  • How to use get() method of hashmap in jsp

    Hi,
    Iam using hashMap in action form from which I want to retrieve the value by giving the key in jsp page.
    ex: HashMap m = new HashMap();
    m.add("key", "value");
    String v = m.get("key");
    I want to know how implement m.get("key") in jsp without doing iteration.
    Thanks & Regards,
    Nasrin.N

    Hi
    First of all I would say that there is no "add" method for Hashmap, its put
    secondly try this
    <bean:write property="map_key" name="mapSetterGetter" />

  • Help required in understanding when to use encodeChildren() method

    I am new to Java Server Faces. I am a little bit confused in understanding the uselfulness of encodeChildren() method in renderers? Can any one explain how a datatable component gets rendered?how is it that that row by row processing takes place?

    TableRenderer.encodeChildren() is something you can easily imagine:while(there is the next row) {
      UIData.setRowIndex(++rowIndex);
      write("<tr>");
      while(there is the next column) {
        write("<td>");
        while(there is the next component in the column) {
          nextComponent.encodeBegin();
          nextComponent.encodeChildren();
          nextComponent.encodeEnd();
        write("</td>");
      write("</tr>");
    }

  • How to suppress line #s fr. rows in SPOOL output file when I use GET

    I'm having difficulty suppressing line #s which show up in my SPOOL output. That is, when I run the following
    SPOOL MySpoolOutputFile.txt
    GET SpoolHeader.txt LIST
    where MySpoolOutputFile is my spool output destination and SpoolHeader is what I'm getting and displaying in the console.
    I get a result like the following:
    1 This is my first row
    2 This is my second row
    3 This is my third row
    4 This is my fourth row
    5 This is my fifth row
    I have my environmental variables set to the following:
    SET FEEDBACK OFF
    SET TRIMSPOOL ON
    SET LINESIZE 100
    SET SQLNUMBER OFF
    SET SQLPROMPT ''
    I'd like to suppress the line numbers but can't find any other SQL*PLUS environment variable that seems to let me do this....
    Thanks, in advance, for any advice!
    Chris
    null

    1. Is the first column in the select clause "rownum"?
    --Stephen
    null

  • Help! Strange things happen when I use Get Info command

    Hi, I have updated iTunes for 7.7.1, and since then a strange thing happen: whenever I pick a Smart Playlist, select a song and use the Command-I, the Get Info screen appears for a few seconds, and then the "Cancel" button is highlighted, as if I had clicked on it, and the screen is closed.
    Funny thing is that I am not clicking the "Cancel" button, but it happens automatically after a few seconds, and only with songs in the Smart Playlists. I haven't found a thing about it at the Discussion forums, can anyone help?

    In iTunes, right click on the file and Get Info.
    Make sure it is marked Remember Playback Position.

  • 160n halt when connected using this method

    hi there,
    I have the following scenario which cause router 160n to be down
    I have a 160n linksys router which is used as dsl router and directly connected to the internet, and I have another linksys router 160n which is connected to the first  160n router "DSL Router", and linux server (Squid & dhcp) which is also connected directly to the first 160n router " DSL router",
    the problem accurs when I turn my linux srever on, the DSL router start flashing its lights and stop working until I disconnect my server and restart the router.
    I wonder if anybody can help,
    thanks with best regards

    Make sure you have different IP for both routers and they are cascaded correctly.  Search the Linksys web site on how to cascade two routers correctly.

  • When i used invoke methode with read out variants array byte crashd my LV by recal the second repeat?

    If i check it with VBASIC it runs fine, check it to run with Delphi its fine, wot is wrong with LV 6.02

    You may want to contact National Instruments directly. Try: www.ni.com/ask
    Brian

Maybe you are looking for