Expand my Community achievements bar.

Problems with DataService

Avatar

Level 3
Hi all,

I tried to make the most simple program I could imagine and
didnt work! :(

I'll describe the steps I took here and you guys try to
figure what's wrong OK? thank you!:




The index.mxml is as follows:


quote:





<?xml version="1.0"?>

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml">

<mx:DataService id="ds" destination="users"/>

<mx:ArrayCollection id="usersCollection"/>

<mx:DataGrid id="dg" dataProvider="{usersCollection}"
editable="false">

<mx:columns>

<mx:DataGridColumn dataField="name" headerText="User
Name"/>

</mx:columns>

</mx:DataGrid>

<mx:Button label="Get Data"
click="ds.fill(usersCollection)"/>

</mx:Application>





this code should just show a single-column list of users



Now the server-side configuration:




The destination:


quote:





<destination id="users">

<adapter ref="java-dao" />

<properties>

<source>chat.UsersAssembler</source>

<scope>application</scope>

<cache-items>true</cache-items>

<metadata>

<identity property="name"/>

</metadata>

<network>

<session-timeout>20</session-timeout>

<paging enabled="true" pageSize="10" />

<throttle-inbound policy="ERROR" max-frequency="500"/>

<throttle-outbound policy="REPLACE"
max-frequency="500"/>

</network>

<server>

<fill-method>

<name>loadUsers</name>

</fill-method>

<sync-method>

<name>syncUsers</name>

</sync-method>

</server>

</properties>

</destination>





I asure that the adapter existis and the rmtp channel is
configured



Now the Java code, Im in doubt of the folder hierarchy... so
I'll put the one I used here



my application is inside flex directory in default server so
the classes go here

C:\fds2\jrun4\servers\default\flex\WEB-INF\classes



I created a package chat as I described in the destination
and put 2 files within it




User.class as follows


quote:





package chat;



public class User {

private String name;



User(String name){

this.name = name;

}



public void setName(String name){

this.name = name;

}



public String getName(){

return name;

}

}






and UserAssembler as follows


quote:





package chat;



import java.util.ArrayList;

import java.util.List;



public class UsersAssembler {

public List loadUsers(){

ArrayList myList = new ArrayList();

myList.add(new User("Andre"));

myList.add(new User("Japa"));

myList.add(new User("Flay"));

return myList;

}



public void syncUsers(){

}

}





I didnt define sync method because I didnt use it in the
application



I wrote this useless simple application just to test, but
when I press the button to fill my ArrayCollection no data is
retrieved..



The error I get is:


quote:





[RPC Fault faultString="Send failed"
faultCode="Client.Error.MessageSend"
faultDetail="Channel.Connect.Failed error null"]

at mx.data::ConcreteDataService/
http://www.adobe.com/2006/flex/mx/internal::dispatchFaultEvent()

at ::DataListRequestResponder/fault()

at mx.rpc::AsyncRequest/fault()

at mx.messaging::ChannelSet/::faultPendingSends()

at mx.messaging::ChannelSet/channelFaultHandler()

at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent()

at
mx.messaging::Channel/mx.messaging:Channel::connectFailed()

at
mx.messaging.channels::PollingChannel/mx.messaging.channels:PollingChannel::connectFailed()

at
mx.messaging.channels::RTMPChannel/mx.messaging.channels:RTMPChannel::statusHandler()







The grid shows empty.. anyone knows why???

thanks
3 Replies

Avatar

Level 2
How do you compile the application?



If you use the web tier compiler and request for compile via
the browser, you shouldn't have issues communicating with the
server.



If you're compiling via Flex Builder or the Flex SDK, please
be sure that you specify both -services pointing to your
services-config.xml and -context-root designating your context-root
as part of the compiler arguments.



See the following Tech Note for information on configuring
the context-root -


http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=e329643d

Avatar

Level 3
Hi CathyM,

thanks for your support



Yes I'm using the web tier compiler, I'm hitting index.mxml
at the browser.



Dont you see any possible problem at the code above?



thank you

Avatar

Level 3
How can I know what tier is the problem???



Client isnt requesting right?

FDS is not configured properly?

Java is unaccessible?



I'm lost :(