[ADF, JDev12.1.3] Java webservice class methods mapping: which are the best practices? I seek advice from experts...

Hallo,

in my application (let's call it "MyADFApp"), I created a Java class (let's call it 'Services') which maps simply a C++ application methods (let's call it "Différendsapp") similar to a Web service.

"Différendsapp" works on the same machine where the "MyADFApp" (works on Glassfish).

I need to use the 'Services' methos both in the model layer and ViewController so:

  • I imported 'Services' in the AppModuleImpl
  • I created in the AppModuleImpl method for each method of 'Services '.
  • I exposed these new methods of AppModuleImpl for the ViewController
  • I configured class 'Services' to call "Différendsapp" on localhost since it runs on the same computer in 'MyADFApp '.

In AppModuleImpl, I can call 'Services' methods directly while controlled beans think I call these methods to help

    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    OperationBinding operationBinding = bindings.getOperationBinding("ServicesMethodToCall");
    operationBinding.getParamsMap().put("param1", param1value);
    operationBinding.getParamsMap().put("param1", param2value);
    operationBinding.execute();

I am a beginner and I would like to know by experts if the instinctive approach I follewed is good or not and if JDev/ADF offers me a better way to use my class of 'Services '.

For example, I tried to convert my class of 'Services' in a DataControl and I wonder if will work it after you have configured the class to use localhost or not.

I wonder if after you have configured the class to use localhost will work in the case I have to import/use also the class directly in managed bean (which I did in AppModuleImpl).

I would be happy if you could answer my questions and give me some explanation.

Thank you

Federico

Refer

https://groups.Google.com/Forum/#! subject/adf-methodology/9NPM6J64f0E

http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/92-cache-WS-queries-523136.PDF

Tags: Java

Similar Questions

  • What is the best practice for the enumeration for the ADF?

    Dear all,

    What is the best practice for the enumeration for the ADF?

    I need to add the enumeration to my request. ex: sex, marital status.

    How to deliver? Declarative custom components or is there another way?

    Thank you.
    Angelique

    Check out this topic - '5.3 fill view object Rows with static data' in Guide of Dev
    http://download.Oracle.com/docs/CD/E17904_01/Web.1111/b31974/bcquerying.htm#CEGCGFCA

  • Which is the best way for a function called identify the class name of the appellant.

    Which is the best way for a function called identify the class name of the appellant.

    (1) sun.reflect.Reflection using the function call
                    Class caller = Reflection.getCallerClass(2);
                    System.out.println("Caller Class Name ::"+caller.getName());
    Trace of function called battery 2) analysis of current threads
                    StackTraceElement[] stElements=Thread.currentThread().getStackTrace();
                    System.out.println("Caller Class Name ::"+stElements[3].getClassName());
    Y at - it all the other ways to achieve the same. What is the best way?
    Called function does accept no argument, I don't want the arguments of function calling function called t.

    Help, please.

    With greetings
    Paul

    798185 wrote:
    Which is the best way for a function called identify the class name of the appellant.

    Y at - it all the other ways to achieve the same.

    SecurityManager

        // 0 is the anonymous SecurityManager class
        // 1 is this class (also works in static context)
        // 2 is calling class
        static Class getClass(int i) {
            return new SecurityManager() {
                protected Class[] getClassContext() {
                    return super.getClassContext();
                }
            }.getClassContext();} 
    
  • [ADF, JDev12.1.3] Which is the best way to define the properties of CIU/fragments of pages. Is the approach that I have used a good choice (for a beginner)?

    Hallo,

    in my app, that I have a lot of pages and fragments in which properties (for example rendered text, disabled, Selected,...), lots of user interface components must be set, before/when the page is displayed, depending on the session and pageFlow scope attributes.

    So far I have created for each page/one backingBean brought bean fragment in which I defined an attribute for each property defined (e.g. 2 properties for each UIC: UIC is 10...) "I have 20 attributes to manage in the bean).

    Then, I linked each attribute of the bean to the respective UIC property. You can see in this my thread (unfortunately without answers ) [ADF, JDev12.1.3] backingBean bean: a lot of properties to set for lots of CIU... is better by using the properties of the binding or access code (created by ID) UIC? a small example. I put the attributes the bean Builder (or in a function of 'action' if the APP properties must be set based on the interaction of the user).

    I would like to know:

    • If it is a good approach / recommended / safe or if there is a better way;
    • If the scope backingBean is OK, or if a larger scope would be better.

    As I asked in the thread in the link above, the situation can become difficult to manage if the PPP for which setting, properties are very different.

    So I'd like if there is no alternative that I can use to get the same result with less effort.

    For example, using the class ComponentReference or invokeOnComponentAPI could simplify my life? And their use could I always use backingBean brought beans?

    Thank you

    Federico

    Federico, please understand that this forum has no sla. I have other work to do, who pays my bills. I will do my best to help, but you can not expect the instant replay.

    (1) you must not use the bean to init your beans. You can delay load or init your beans instead.

    (2) as Frank and says you can use a bean to view range and use it to make your calculations as long as you know how their parameters go to the btf

    (3) you should always use the reference of the component if you bind a component to a bean. Make a habit of all scopes.

    As we do not know how you calculate the State and how often it changes while the Working Group is on the page, it is difficult to give further advice.

    Timo

  • SSD: Which method of installation is the best?

    I install my first Samsung SSD in a new XPS 8700.  It will be the boot drive for the Windows 7 operating system and program applications.  I have 3 options and am trying to decide which route to go:

    1. Use the migration software provided with the SSD drive for quick transfer.  Apparently, it does not copy the Dell partition.
    2. Installing from the Dell System Restore DVD I did when I ran the system.  This restores the Dell, or just the OS partition?
    3. A new installation of Windows 7 using the OS disc (which I have).  No Dell partition with this method.  Drivers must be installed.  I have the Dell drivers (rev A00) disk, dated April 2013, so I don't know how current drivers are out there, but I can download the most recent.  This method would require special SATA drivers be loaded during the installation?

    And what I need to do any special partitioning?   Thanks for your suggestions/comments.

    None of the special SATA drivers not necessary, and I would recommend to go with option 3: the new installation of Windows 7. Download the latest drivers for Win7 64 bit for Dell website, but I do not recommend updated the A06 BIOS/UEFI. Stick with A03 if that's what you already have. You can use a free application like 'Speccy' to see what you have (in the "motherboard" section). Also check that you are running in mode "AHCI" (as opposed to "IDE") in the BIOS/UEFI.

    If your 8700 was running Windows 7 and nothing additional is needed beyond what is mentioned above. But if your XPS 8700 has been running Windows 8/8.1, you will need change some settings in the BIOS/UEFI before installing Windows 7. If this is the case for you, here's how to (search the page for "XPS 8700"):

    http://support.Dell.com/support/topics/global.aspx/support/KCS/document?docid=590895&DoNotRedirect=y

  • [ADF, JDev12.1.3] LOV entry: is it possible to change the criteria to view / query to use before the opening of the popup?

    Hallo,

    I would like to know if it is possible to change the criteria for the view or the query used by an LOV entry before the opening of the pop-up window (on the click the icon in the search).

    Thank you

    Federico

    You can change the implicit vc used by the LOV, overwriting the popuplistener and a different VC as

    {} public void onLauchLov (LaunchPopupEvent launchPopupEvent)

    String submittedValue = (String) launchPopupEvent.getSubmittedValue ();

    run the queries only if value is submitted

    If (submittedValue! = null & submittedValue.length () > 0) {}

    RichInputListOfValues lovComp = launchPopupEvent.getComponent ((RichInputListOfValues));

    BindingContext bindingCtx = BindingContext.getCurrent ();

    BindingContainer links = bindingCtx.getCurrentBindingsEntry ();

    JUCtrlListBinding lov = bindings.get ("JobId") (JUCtrlListBinding);

    VCM ViewCriteriaManager = lov.getListIterBinding () .getViewObject () .getViewCriteriaManager ();

    ensure that the criteria of display is disabled

    vcm.removeViewCriteria (ViewCriteriaManager.IMPLICIT_VIEW_CRITERIA_NAME);

    Create a new view of the criteria of

    ViewCriteria vc = new ViewCriteria (lov.getListIterBinding () .getViewObject ());

    Use the name of the default view criteria

    '__DefaultViewCriteria__ '.

    vc.setName (ViewCriteriaManager.IMPLICIT_VIEW_CRITERIA_NAME);

    create a display for all queryable attributes criteria

    VCR ViewCriteriaRow = new ViewCriteriaRow (vc);

    for this example, I put the query filter for 60 DepartmentId.

    You can determine when running in reading to a managed bean

    or the link layer

    vcr.setAttribute ("JobId", submittedValue + "%");

    Note also that the line of view criteria consists of all attributes

    who belong to the view list LOV object, which means that you can

    filter on multiple attributes

    vc.addRow (vcr);

    lov.getListIterBinding () .getViewObject () .applyViewCriteria (vc);

    }

    }

    Here's the LOV on the employee on the work of attribte based on http://www.oracle.com/technetwork/developer-tools/adf/learnmore/29-adf-model-driven-llist-of-values-169171.pdf

    Timo

  • [ADF, JDev12.1.3] Form based on EO VO istance basis: which is the best place where to score the extra required fields?

    Hallo,

    I created a form of a base EO VO istance.

    The EO has auto-marqué as asterisk fields in the db table on which it is based.

    Self-validation as happens on these fields, but I want to force the user to fill in the other fields.

    What is the best blace where to add other fields of cumpolsory?

    So far, I did it in the attributes of the OS... but I would like to know if it's OK.

    Thank you

    Federico

    Yes, this is logical job for each line that is the place to mark the attribute as mandatory.

    In this way, the validation is done as for the other attributes.

    Timo

  • [ADF, JDev12.1.3] Best practices for maintaining a form validation

    Hallo,

    in my application, I need to create a registration form which contains fields that must be validated (for example they should follow a format like e-mail, phone number, tax code,...).

    If the data inserted by the user are ok, a new record in my custom db table Users will be created.

    I would like to know which are the best practices for maintaining the validation, which means the place where the controls must be made and a message to the user who fills out the form when something goes wrong.

    The best vo or EO or managed bean? Or some controls should be put in the OS, others in the VO and other in the managed bean?

    I would be happy if you could give me some examples.

    Thank you

    Federico

    Assuming you want the validation on the value of the field to any screen data can be entered in (and possibly web services that rely on the same BC ADF) then put the validation on the definition of the attribute in the EO.

    If you want to add a little more friendliness and eliminate some of the network traffic to the server, you can also implement the validation client in your page - for example by using the regular expression validator.

    https://blogs.Oracle.com/Shay/entry/regular_expression_validation

  • Call a Java Webservice using PLSQL in Oracle

    Hello Experts

    Greetings of the day!

    We are working on a reuirement to call a Web service based on Java (it's in SOA environment) environment EBS PLSQL to get the answer based on some input parameters.

    This webservice is password protected, here are the challenges that we faced:

    (1) we are not able to set the username and password required to connect to the service when it is called from PLSQL.

    (2) even if we connect to the Web service, there is a challenge to store the response of Webservice.

    If one has ever faced such a requirement or had the idea of how to implement, please let us know.

    Any idea will be highly appreciated.

    Thank you

    Mirza Yahya

    Hi Mizra,

    do not too complicated.

    To retrieve the value of XML, you can follow one of the example 2 below depending on the version of DB you have. If you have 11 GR 2 or more then use the second method:

    declare
       l_xml_response         xmltype;
       l_xml_ns1              varchar2(200);
       l_response_address1    varchar2(200);
       l_response_address2    varchar2(200);
       l_response_address3    varchar2(200);
       l_response_address4    varchar2(200);
       l_response_city        varchar2(200);
       l_response_state       varchar2(200);
       l_response_county      varchar2(200);
    
    begin
       l_xml_response :=    xmltype('
    
      
        urn:936AE390E76011E4BFC99D8059113E1A
        
          http://www.w3.org/2005/08/addressing/anonymous
        
        
          http://www.w3.org/2005/08/addressing/anonymous
        
      
      
        
          00282
          00001
          
          
          6200 E Sam Houston Pkwy N                                                                           
          ?
          
          
          Houston                     
          Harris                   
          TX
          770497260
          
          
          N
          2
          
          
          
          
          
          B
          SUCCESS
          
        
      
    ');
    
       l_xml_ns1:= 'xmlns:ns1="http://xmlns.oracle.com/Group1AddressValidateService/AddressValidation"';
    
       -- pre 11gR2 (using extractvalue)
    
       select extractvalue( l_xml_response, '//ns1:ADDRESS_LINE1', l_xml_ns1) as address1
            , extractvalue( l_xml_response, '//ns1:ADDRESS_LINE2', l_xml_ns1) as address2
            , extractvalue( l_xml_response, '//ns1:ADDRESS_LINE3', l_xml_ns1) as address3
            , extractvalue( l_xml_response, '//ns1:ADDRESS_LINE4', l_xml_ns1) as address4
            , extractvalue( l_xml_response, '//ns1:CITY'         , l_xml_ns1) as city
            , extractvalue( l_xml_response, '//ns1:STATE'        , l_xml_ns1) as state
            , extractvalue( l_xml_response, '//ns1:COUNTY'       , l_xml_ns1) as county
         into l_response_address1
            , l_response_address2
            , l_response_address3
            , l_response_address4
            , l_response_city
            , l_response_state
            , l_response_county
         from dual;   
    
       dbms_output.put_line('Pre 11gR2:');
       dbms_output.put_line('Address1 :'||l_response_address1);
       dbms_output.put_line('Address2 :'||l_response_address2);
       dbms_output.put_line('Address3 :'||l_response_address3);
       dbms_output.put_line('Address4 :'||l_response_address4);
       dbms_output.put_line('City     :'||l_response_city);
       dbms_output.put_line('State    :'||l_response_state);
       dbms_output.put_line('County   :'||l_response_county);
    
       -- 11gR2 onwards
       select x.address1
            , x.address2
            , x.address3
            , x.address4
            , x.city
            , x.state
            , x.county
         into l_response_address1
            , l_response_address2
            , l_response_address3
            , l_response_address4
            , l_response_city
            , l_response_state
            , l_response_county
         from xmltable( xmlnamespaces( default 'http://xmlns.oracle.com/Group1AddressValidateService/AddressValidation'
                                     , 'http://xmlns.oracle.com/Group1AddressValidateService/AddressValidation' as "ns1"
                                     )
                      , '//ADDRESS_VALIDATION_RESPONSE'
                       passing l_xml_response
                       columns "ADDRESS1" varchar2(200) path 'ns1:ADDRESS_LINE1'
                             , "ADDRESS2" varchar2(200) path 'ns1:ADDRESS_LINE2'
                             , "ADDRESS3" varchar2(200) path 'ns1:ADDRESS_LINE3'
                             , "ADDRESS4" varchar2(200) path 'ns1:ADDRESS_LINE4'
                             , "CITY"     varchar2(200) path 'ns1:CITY'
                             , "STATE"    varchar2(200) path 'ns1:STATE'
                             , "COUNTY"   varchar2(200) path 'ns1:COUNTY'
              ) x;
    
       dbms_output.put_line('------------------');
       dbms_output.put_line('11gR2 onwards:');
       dbms_output.put_line('Address1 :'||l_response_address1);
       dbms_output.put_line('Address2 :'||l_response_address2);
       dbms_output.put_line('Address3 :'||l_response_address3);
       dbms_output.put_line('Address4 :'||l_response_address4);
       dbms_output.put_line('City     :'||l_response_city);
       dbms_output.put_line('State    :'||l_response_state);
       dbms_output.put_line('County   :'||l_response_county);
    
    end;
    /
    

    Here it the output of the above script:

    Pre 11 GR 2:

    Address1: 6200 E Sam Houston Parkway N

    Address2:?

    Address3:

    Address4:

    City: Houston

    State: TX

    County: Harris

    ------------------

    11 GR 2 from:

    Address1: 6200 E Sam Houston Parkway N

    Address2:?

    Address3:

    Address4:

    City: Houston

    State: TX

    County: Harris

    Kind regards.

    Alberto

  • [ADF, JDev12.1.3] Managed beans: when I have to worry about serialization (de)?

    Hallo,

    I would like to know what type of beans and in which case, I have to worry about serialization (de).

    When is it enough to simply add implements Serializable class definition? Which is the right class to import?

    And when I really need to implement (de) serialization by myself and how I can do? One (or more) example forward.

    For example, in a range session bean I use a recorder and some standard attributes...

    public class Login  {
      private final Logger logger = oaw.model.Config.getLogger(Login.class.getName());
      String A;
      Integer X;
      // ...
    }
    
    

    ... what should I do?

    In general, if a bean stores no data (de) serialization has no matter, right?

    Information you provide me... better is

    Thank you

    Federico

    I would like to know what type of beans and in which case, I have to worry about serialization (de).

    In all the grains that can survive a http request-response cycle.

    It is usually related to clustering, but it may be important if you use UserData structure in AM.

    When is - it enough to simply add implements Serializable class definition? Which is the right class to import?

    When you have java simple types or types that already implement the Serializable interface.

    See: Serializable (Java SE 7 platform)

    For example, in a range session bean I use a recorder and some standard attributes...

    1. public class {Login
    2. private final Logger logger = oaw.model.Config.getLogger (Login.class.getName ());
    3. String A;
    4. Integer X;
    5. // ...
    6. }

    ... what should I do?

    Just mark your connection with the Serializable attribute class.

    In general, if a bean stores no data (de) serialization has no matter, right?

    Right.

    In addition, this article can be useful for you:

    http://www.Ateam-Oracle.com/rules-and-best-practices-for-JSF-component-binding-in-ADF/

    Dario

  • What is the best way to call a method in the bean on the adf page loading?

    Hello

    which is the best way to call a method in managing the beans on the adf page loading.

    My version of jdev 11.1.1.5.0

    Thank you

    I don't know if it's the right answer for your question try this...

    In taskflow for properties of method call, you must return a value when you use #{pageFlowScope.returnvalue} (returnvalue is a variable), so you can use your return value in the taskflow... Please let me if this is correct...

  • [ADF, JDev12.1.3] master / detail af:tables the link is handled by ExecuteWithParams: how to create a master report / detail in a loop on the lines?

    Hallo,

    I have a page with 2 legs and they both contains an af:table created by dragging an instance of VO in the user interface.

    The 1st tab uses a master VO while the 2nd uses a VO detail.

    Between 2 your, there is not a link of VO master / detail.

    Opening Details tab I update the secondary table by calling the method ExecuteWithParams of the detail VO instance (in a managed bean).

    I would now like to generate a report that loop on the master table and that, for each line of master:

    • He writes in the report;
    • loops of registration of details (which are based on the master record) and also writes the report.


    Could you kindly suggest me which is the best way to achieve that through a code to write in a managed bean?

    Here I am interested how do to loop through the data, not in how to write the report.

    Thank you

    Federico

    Yes it will affect the selected line. If you want to ignore try using this code

        DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("DepartmentsView1Iterator");
        ViewObject vo = iter.getViewObject();
        for (int i = 0; i < vo.getEstimatedRowCount(); i++)
        {
          Row r = vo.getRowAtRangeIndex(i);
          System.out.println("DeptId= " + r.getAttribute("DepartmentId"));
        }
    
  • [ADF, JDev12.1.3] How to create a new record in a table filling one filed with the IP address of the client?

    Hallo,

    I create a stubborn workflow that begins with a create operation on the table where a new record should be added.

    The recording fields must be filled in by the user, but before committing, I have to fill a field of the reocord with the address IP of the PC of the user.

    Could you kindly advice me which are the possible recommended approaches to achieve this?

    Thank you

    Federico

    Hello

    See this post: Blog of Zeeshan Baig: how to get the IP address of the customer in ADF merge request

    You can use a createWithParams operation and to fill in this field.

    Reference: Andrejus Baranovskis Blog: CreateWithParams operation for Oracle ADF 11g BC

    Kind regards

    Ruben.

  • Where to put the java code - best practices

    Hello. I work with the Jdeveloper 11.2.2. I'm trying to understand the best practices for where to put the code. After reviewing the http://docs.oracle.com/cd/E26098_01/web.1112/e16182.pdf, it seemed that request module was the preferred location (although many examples in the pdf file reside in the main methods). After some time of coding, if, I noticed that there was a certain libraries imported and wondered if this would impact performance.

    I looked at the articles published on the forum, in particular Re: programmatically access the method of service (customer interface) . This link mentions for access to the code a bean of support - and the bulk of the recommendations seem to be using the data control to drag to the Joint Strike Fighter, or use the links to access code.

    My interest lies in where to put the java code in the first place; In the view object, entity object, and... other Am, backing bean object?

    I can describe several guess better know where to put the code and the advantages and disadvantages:

    1. in the application module
    Benefits: Central location for code makes development and support easier as there are not multiple access points. Kinda like a data control centralizes the services, the module of the application can act as a conduit for the different parts of the code you have in your model objects.
    Cons: Everything in one place means that the module of the application becomes bloated. I don't know how the memory works in java - if the app module has tons of different libraries are all called when even a method of re - run a simple query is called? Memory of pigs?

    2. write the code in the objects it affects. If you write code that accesses a view object, write it to a display object. Then make it visible for the customer.
    benefits: the code is accessible through ducts less (for example, I expect that if you call the module from the application of a JSF backing bean, then the module of the application calls the view object, you have three different pieces of code-)
    CONT: the code gets spread, more difficult to locate etc.

    I would greatly appreciate your thought on the issue.


    Kind regards
    Stuart

    Published by: Stuart Fleming on May 20, 2012 05:25

    Published by: Stuart Fleming on May 20, 2012 05:27

    First point here is when you say 'where to put the code of java' and you're referring to ADF BC, the point is that you put 'code of java business logic' in the ADF business components. Of course it is very good to have the Java code in the ViewController layer that covers the user interface layer. Just don't put the business logic in the user interface layer and don't put no logical user interface in the model layer. In your 2 examples you seem to consider the ADF BC layer only, so I'll assume that you're not only serious logic java code.

    Meanwhile, I'm not keen on best practices in the term that people are following best practices without thinking, usually best practices come with conditions and forget to apply. Fortunately you do not here that you have thought through the pros and cons of each (nice work).

    Anyway, back on topic and turn off my soap box, regarding where to put your code, my thoughts:

    (1) If you have only 1 or 2 methods set in the AppModuleImpl

    (2) If you have hundreds of methods, or there is that a chance #1 above will turn into #2, divide the code between the AppModuleImpl, the ViewImpl and the ViewRowImpls. Why? Because your AM will become overloaded with hundreds of methods making it unreadable. Put the code where it should logically go instead. Methods that operate on a specific line of VO Approfondissez partner ViewRowImpl, methods that work across lines in a VO enter the ViewImpl and methods that work throughout your in the associated AppModuleImpl.

    To be honest that you never the option you choose, one thing I recommend as a best practice is to be consistent and document standard so not know your other programmers.

    BTW, it is not a question about loading a lot of libraries/imports in a class, it has no performance cost. However if your methods require a lot of class variables, then yes there will be a memory of the costs.

    On a side note, if you are interested in more ideas on how to create ADF applications properly think about joining the EMG "ADF", a forum which deals with ADF architecture, best practices (cough), deployment architectures free online and more.

    Kind regards

    CM.

  • Java native interface: best practices?

    Hi all
    I'm trying to access a database with the C API from a tomcat/glassfish server by using API native Java.

    I put the environment in the context of the application for all users will share the same instance of the database.

    first question: is this a good idea? What would be the best practice? can I use this application in a multithreaded environment?

    The problem was that the 'System.loadLibrary' method is called whenever my application is redeployed: If an exception was thrown (library already loaded), because the server has already loaded the db library in a previous deployment. To solve the problem, I put a silencer ' try... catch...» "around this System.loadLibrary in the source code of com/sleepycat/db/internal/db_javaJNI.java

    2nd question: is there a way to avoid this hack?

    Thank you for any response

    Stone

    Hi Pierre,.

    Sorry for the delay in his response to this request.

    In answer to your first question, it is to access a Berkeley DB environment handle from multiple threads in Java. No specific configuration is required.

    The second question is not specific to Berkeley DB: it applies to any library JNI accessed via a class loader other than the system class loader. For example, see this thread:

    http://forums.Sun.com/thread.jspa?threadID=633985

    In the case of Berkeley DB, where you're unlikely to deploy a version update on the fly, the simplest solution is to make sure that the native library is loaded by the class loader running Tomcat with db.jar common/lib, and no WEB-INF/lib of your webapp.

    Kind regards
    Michael Cahill, Oracle Berkeley DB.

Maybe you are looking for