flex与java的socket通信_Flex通过Blazeds和Java通信

1.Flex端

(1)

encoding="utf-8"?>

layout="absolute"

viewSourceURL="srcview/index.html">

import

mx.controls.Alert;

import

mx.rpc.events.ResultEvent;

function

gg(evnet:ResultEvent):void{

var ff:String = evnet.result as

String;

ggg.text = ff;

}

function

remotingSayHello():void{

var sname:String =

nameInput.text;

h.sayHello(sname);

}

]]>

destination="hello" id="h"

result="gg(event)"

fault="mx.controls.Alert.show(event.fault.message)"

>

id="ggg" x="109" y="122"/>

label="say hello" click="remotingSayHello();" x="144"

y="193"/>

id="nameInput" x="109" y="73"/>

text="name" x="47" y="75"/>

(2)proxy-config.xml

encoding="UTF-8"?>

class="flex.messaging.services.HTTPProxyService">

100

2

true

class="flex.messaging.services.http.HTTPProxyAdapter"

default="true"/>

class="flex.messaging.services.http.SOAPProxyAdapter"/>

(3)remoting-config.xml

encoding="UTF-8"?>

class="flex.messaging.services.RemotingService">

class="flex.messaging.services.remoting.adapters.JavaAdapter"

default="true"/>

id="hello"> 

(4)services-config.xml

encoding="UTF-8"?>

/>

/> 

class="flex.messaging.security.TomcatLoginCommand"

server="Tomcat"/>

class="mx.messaging.channels.AMFChannel">

class="flex.messaging.endpoints.AMFEndpoint"/>

(5)编译断加上:-locale en_US -services services-config.xml

2.Java端

(1)Java_FlexTest.java

package com.protel;

public class HelloWorld {

public String sayHello(String str){

System.out.println("ni da

ye:"+str);

return "kenny say "+str;

}}

(2)proxy-config.xml

encoding="UTF-8"?>

class="flex.messaging.services.HTTPProxyService">

100

2

true

class="flex.messaging.services.http.HTTPProxyAdapter"

default="true"/>

class="flex.messaging.services.http.SOAPProxyAdapter"/>

(3)remoting-config.xml

encoding="UTF-8"?>

class="flex.messaging.services.RemotingService">

class="flex.messaging.services.remoting.adapters.JavaAdapter"

default="true"/>

id="hello">

com.protel.HelloWorld

(4)services-config.xml

encoding="UTF-8"?>

/>

/>

class="flex.messaging.security.TomcatLoginCommand"

server="Tomcat"/>

class="mx.messaging.channels.AMFChannel">

class="flex.messaging.endpoints.AMFEndpoint"/>

class="mx.messaging.channels.SecureAMFChannel">

class="flex.messaging.endpoints.SecureAMFEndpoint"/>

false

class="mx.messaging.channels.AMFChannel">

class="flex.messaging.endpoints.AMFEndpoint"/>

true

4

level="Error">

[BlazeDS]

false

false

false

false

Endpoint.*

Service.*

Configuration

false

(5)web.xml

encoding="UTF-8"?>

xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

flex.class.path

/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars

flex.messaging.HttpFlexSession

MessageBrokerServlet

flex.messaging.MessageBrokerServlet

services.configuration.file

/WEB-INF/flex/services-config.xml

1

MessageBrokerServlet

/messagebroker/*

index.jsp

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值