Flex + BlazeDS + Java (works only on localhost)
hi!
i'm new in flex have incomplete knowledge in many issues. use java write applications now, need connect java flex. read articles , tutorials integration using blazeds still have problem. made simple web app , works, on localhost. if upload app on server works can't call java methods.
applicaton copy text textinput label when user press button.
below add content of files (remote-config.xml, services-config.xml, web.xml , flex main mxml file)
remote-config.xml
<?xml version="1.0" encoding="utf-8"?>
<service id="remoting-service"
class="flex.messaging.services.remotingservice">
<adapters>
<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.javaadapter" default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
</service>
services-config.xml
<?xml version="1.0" encoding="utf-8"?>
<services-config>
<services>
<service-include file-path="remoting-config.xml" />
</services>
<channels>
<channel-definition id="my-amf" class="mx.messaging.channels.amfchannel">
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.amfendpoint"/>
</channel-definition>
</channels>
<logging>
<target class="flex.messaging.log.consoletarget" level="error">
<properties>
<prefix>[blazeds] </prefix>
<includedate>false</includedate>
<includetime>false</includetime>
<includelevel>false</includelevel>
<includecategory>false</includecategory>
</properties>
<filters>
<pattern>endpoint.*</pattern>
<pattern>service.*</pattern>
<pattern>configuration</pattern>
</filters>
</target>
</logging>
<system>
<redeploy>
<enabled>false</enabled>
</redeploy>
</system>
</services-config>
flex-servlet.xml
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:flex="http://www.springframework.org/schema/flex"
xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemalocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<flex:message-broker>
<flex:remoting-service default-channels="my-amf"/>
</flex:message-broker>
<context:annotation-config />
<context:component-scan base-package="blah" />
</beans>
web.xml
<?xml version="1.0" encoding="utf-8"?>
<!doctype web-app public "-//sun microsystems, inc.//dtd web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>blazeds spring integration application</display-name>
<description>blazeds spring integration application</description>
<servlet>
<servlet-name>flex</servlet-name>
<servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>rdsdispatchservlet</servlet-name>
<display-name>rdsdispatchservlet</display-name>
<servlet-class>flex.rds.server.servlet.frontendservlet</servlet-class>
<init-param>
<param-name>useappserversecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>messagebrokerid</param-name>
<param-value>_messagebroker</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping id="rds_dispatch_mapping">
<servlet-name>rdsdispatchservlet</servlet-name>
<url-pattern>/cfide/main/ide.cfm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>flex</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
</web-app>
fooproject.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600" xmlns:services="services.*">
<fx:declarations>
<s:callresponder id="sayhelloresult"/>
<services:fooservice id="fooservice">
<services:channelset>
<s:channelset>
<s:amfchannel uri="http://mctg.yoyo.pl/webcontent/messagebroker/amf"/>
</s:channelset>
</services:channelset>
</services:fooservice>
</fx:declarations>
<s:textinput id="ti" x="10" y="13"/>
<s:label x="10" y="43" text="{sayhelloresult.lastresult}"/>
<s:button x="146" y="14" label="send" click="sayhelloresult.token = fooservice.sayhello(ti.text)"/>
</s:application>
the problem in opinion in line wchich bold. if change <s:amfchannel uri="http://localhost:8080/webcontent/messagebroker/amf"/> and run on localhost fine. if upload app on server , call java method can wait response never it.
i realize similar threads on forum. read few o them haven't solved problem yet. i grateful help.
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment