Skip to main content

Show the user data of every response for the current Quick Poll in the campaign in a Flex Client, 3rd part

In this part, only we will focus in Flex client, also there are others parts, such as J2EE components, but here we don't consider here because they are out of scope of this blog. It includes to consider the following parts:

  1. Create J2EE Web Proyect, it will contain the flex client created with Flex Builder or Flash Develop IDE.
  2. Create EJB Project , it references to the java project created in the 2nd part of this blog. Here, you'll need to create a stateless session bean, and after to expose some method as Web Service. The NWDS has a wizard to do this taskes. Also, you could create a Web Services directly of the Java project by making use of the NWDS wizards.
  3. Create Flex Builder Project or FlashDevelop IDE, you create a flex client to consume the previuosly web services.
  4. Create Enterprise Project; finally we will add the web and ejb project modules, previously created, to this kind project for deployment our ear file on SAP Netweaver AS 7.0+.

Now, you will review the MXML file of our flex client (we will name FlexWebService.mxml). The main aspects of this file are the web services consumation, the treating of xml response from back end, and the datagrid flex component to show the data.

1. The web services part:




<mx:WebService id="myWebService"
wsdl="http://myserver:50200/SimpleSearchPollWS/sspollconfigws?wsdl">
<mx:operation name="getVotesPerCampaingXmlResponse"
resultFormat="object"
result="resultHandler(event)"
fault="faultHandler(event)">
</mx:operation>
</mx:WebService>



In the wsdl attribute of the mx:WebService tag, we will put the wsdl url of the previously deployed web service.Also, in the tag mx:operation we mention the name of the method to call.

Note: We could consider to make use of the mx:HTTPService component with Servletes, but I have problems with the login sesion. SAP Netweaver AS has using the JASS login (user/password) module by default, then the Flex Client doesn't save the jsession variable of the current logged user and therefore the HTTPService doesn't work. May be by making use of flashvars we could integrate the SSO session on flex client (here some link of possible useful resource ).

2. The treating of xml response from back end.


The response of the back-end need to be treat, then we write the actionscript method named


private function resultHandler(event:ResultEvent):void


This name is put on the "result" attribute of the mx:WebService attribute. Optionally, also we put on the "fault"attribute the name of the "faultHandler" function, in case of some error happen.

private function faultHandler(event:FaultEvent):void


3. The datagrid flex component to show the data.


We will create an ArrayColletion variable (it needs to be Bindable) for to be used in the datagrid component.

[Bindable]
private var myData:ArrayCollection=new ArrayCollection;

This collection will containt the DTO (data transfer object) objects. this kind of object store the information from xml response. This collection containing the dto objects willbe used as data provider of the mx:Datagrid flex component.





<mx:DataGrid id="campaignGrid"
dataProvider="{myData}"
width="100%">
<mx:columns>
<mx:DataGridColumn dataField="name"
headerText="Nombre del Usuario"
width="220"/>
<mx:DataGridColumn dataField="id"
headerText="Id de Usuario"/>
<mx:DataGridColumn dataField="email"
headerText="Email"
width="200"/>
<mx:DataGridColumn dataField="area"
headerText="Area/Departamento"
width="120"/>
<mx:DataGridColumn dataField="response"
headerText="Contesto"
width="120"/>
</mx:columns>
</mx:DataGrid>


Once compiled and released the flex client, it will be integrated on the previously web project module.

Next, a screenshot of the flex client.

Flex Client

You can download the Flex Builder project from here.

Comments

Popular posts from this blog

My first serious Groovy class ..... decompiling java classes with closures

After I read the chapter 6 "closures" of the book Groovy and Grails Recipe, and I decided to use the power of closures of Groovy for resource (files) with other problem that I had, decompile in one step every class of jar library. Well, the purpose of this class is call an external java decompiler (jad) from a Groovy class and execute the command into directory where the jar file was decompressed. And by using the power of closures executes recursively into this directory until find the classes. Well, no more words, here the class package demo class Executor { // directory where the library(jar) was decompressed def path /** * Execute the decompilation of the classes into the directory defined in the path * @return */ def decompileClasses(){ def directory = new File(path) //make use of closures defined in the Object class directory.eachFileRecurse { def name = it.absolutePath //if the current resource hasn't a .class extension continues with

How to .. Integration Non-SAP J2EE-based Web Applications into SAP Portal with SSO Part 1

We are going to integrate Non-SAP J2EE-based Web Applications into the SAP Portal with Application Integrator and SSO. In this part, I will discuss the overall of these posts and configure the iView with Application Integrator Overview of Integration. To perform this integration must take into account the following steps: Deployment of the portal application for the creation of the system portal object Create and set the type of Application Integrator iView that will contain the applications to integrate. Installing SAPSSOEXT and SAPSECU libraries Deployment of the application gateway called SsoGatewayWeb Changing the target application. This integration has the following restrictions: It applies only for web applications based on J2EE Servlet. Depend exclusively on the sucessful load of the libraries supported by SAP (sapssoext and sapsecu) in both Windows and UNIX environments. The target application must have created a profile for the user id logged to the SAP portal, this sh

WebDynpro for Java: Tutorial of the Basic Usage of RoadMap Component

We will create a local Development component project of the type Web Dynpro as follow Our project will contain only 3 views with the purpose of show the basic usage of the roadMap object. After, we create our component controller RoadMap and the RoadMapView view as follow Now, we will create the 2 views more, the previous one will contain only the RoadMap Object (RoadMapView) used in all the project, the other ones show the flow between screens. Here the list of the 3 views: RoadMapView,  InitView, and ConfirmView. Now, we will add the component RoadMap object (it is on the Standar Complex Group) to the RoadMapView view, but first delete the default object added to the view, after we will need to add two steps (it could be more, depends of your logic) to our roadmap object. In order to do that we will use the Outline view of the NWDS. We add the two steps as follow The type steps to add at the RoadMap object will be ot the "RoadMapStep" type. The name of the steps are: Init