4 Replies Latest reply: Apr 8, 2013 12:29 PM by kiransaravi RSS

    ADF Form with a list of values of a specific type

    kiransaravi
      Hi All

      Hope you are doing fine.
      I have a case where I need to create a form with a list of values coming from a webservice.
      This web service takes in a parameter called "field"(type : String[]) and returns all the corresponding values. For Ex, it takes in name and returns all employee names, or takes in id and returns all empId's.

      In my case, I want to pass the value for field as "Name" as input to the webservice and get all the Names and populate them as LOV in the page.
      For this,

      1. I have created a web service data control.
      2. Created a Managed Bean with a property called field of type Object, and initialized it to have a value as "Name" (Why this is created because step 5 is not taking in "Name" as it is expecting Object type and "Name" is just a string - fix as part of the error {Cannot create an object of type:[Ljava.lang.String; from type:java.lang.String with value:Name})
      3. Added the above managed bean in requrest scope to adfc-config.xml
      4. Dragged a view onto adfc-config.xml, created the jspx out of it and dragged and dropped the Name attribute from the DataControl --> myServiceDataControl --> Return --> Name onto it as Single Selection --> ADF Select One Choice(dropdown list).
      5. This asks me to provide an input where I've provided the value as #{requestScope.AppCreationBean.field} (Value will be "Name" which is hardcoded in the managed bean above)


      But when I run the same, it is giving me the following exception
      At least one field must be specified when reading business objects.

      which means that the value "Name" is not getting passed to the Webservice. (I confirmed this by directly invoking the Webservice thru its endpoint in SOAPUI)
      Why is it hapenning? I have initialized it in the Managed bean and using the same, but for some reason, it is not getting passed.
      Would you please help me in this regard?

      Regards
      RaviKiran
        • 1. Re: ADF Form with a list of values of a specific type
          kiransaravi
          Just to mention,
          I have also initialized the variable in the bean as String[] type just to be in accordance with the WS input parameter. But that also does not carry the value to the webservice.

          Regards
          RaviKiran
          • 2. Re: ADF Form with a list of values of a specific type
            Frank Nimphius-Oracle
            Hi,

            to populate a list #{requestScope.AppCreationBean.field} should point to a collection (e.g. Array List) and not Object

            Frank
            • 3. Re: ADF Form with a list of values of a specific type
              kiransaravi
              Hi Frank

              Thanks for the response.
              I've updated my bean to have ArrayList, and added "Name" to it, and returned the objArrayList in the getter method.
              My Bean is as follows
              import java.util.ArrayList;

              public class AppCreationBean {
              private ArrayList epsName = new ArrayList();

              public AppCreationBean() {
              super();
              }


              public void setEpsName(ArrayList epsName) {
              this.epsName = epsName;
              }

              public ArrayList getEpsName() {
              epsName.add("Name"); // Hardcoding the value as this is always same
              return epsName;
              }
              }

              But I'm still getting the exception

              <SOAPProvider> <setParameters> Value for parameter 'Field' cannot be null
              <JAXWSMessageLogger> <errorLogException> Error while invoking endpoint "http://nacisssil201.us.oracle.com:10806/p6ws/services/EPSService" from client; Security Subject: anonymous
              <WebServiceConnectionMessages> <debugExecuteFailure> Failed to execute a SAAJ interaction.
              javax.xml.ws.soap.SOAPFaultException: At least one field must be specified when reading business objects.
                   at oracle.j2ee.ws.client.jaxws.DispatchImpl.throwJAXWSSoapFaultException(DispatchImpl.java:1024)
                   at oracle.j2ee.ws.client.jaxws.DispatchImpl.invoke(DispatchImpl.java:808)
                   at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.synchronousInvocationWithRetry(OracleDispatchImpl.java:235)
                   at oracle.j2ee.ws.client.jaxws.OracleDispatchImpl.invoke(OracleDispatchImpl.java:106)
                   at oracle.adf.model.connection.webservice.impl.SaajInteractionImpl.execute(SaajInteractionImpl.java:76)
                   at oracle.adfinternal.model.adapter.webservice.provider.soap.SOAPProvider.execute(SOAPProvider.java:334)
                   at oracle.adfinternal.model.adapter.webservice.WSDataControl.invokeOperation(WSDataControl.java:259)
                   at oracle.adf.model.bean.DCBeanDataControl.invokeMethod(DCBeanDataControl.java:430)
                   at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:261)
                   at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1635)
                   at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2149)
              ....


              Is there any other way of hardcoding it and passing it as a parameter.

              Regards
              RaviKiran
              • 4. Re: ADF Form with a list of values of a specific type
                kiransaravi
                Hi

                The issue is due to the fact that the parameter to the Binding is coming as null.
                It got resolved just by registering the Bean in the PageFlowScope instead of application/request.

                Also, in the Bean, the type ArrayList was not working, but type String[] is working. (Please note that the type of the WS input parameter is String[])

                But, now I have a problem. How to get these list of values to a LOV?

                If i use a dynamic list, What should be the list datasource?
                I could see only one iterator(service.operation.returnparamName), and if i select the same for both base datasource and list datasource, it is not allowing.
                Just to check if it is really returning the values, I dragged it as an output text, and i got the first value from the return array. So the return parameter in the datacontrol is holding the values.
                Would you please tell me how to build LOV out of this

                Regards
                RaviKiran