blazeds AMFConnection java client

客户端 as AmFconnection http://acatl.net/blog/?tag=amfconnection
package test;
//要调用的远程方法
public class Hello {

	/**
	 * @param args
	 */
	public String getName(String name){
		return name+"hehe";
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

 

package test;

import flex.messaging.io.amf.client.AMFConnection;
import flex.messaging.io.amf.client.exceptions.ClientStatusException;
import flex.messaging.io.amf.client.exceptions.ServerStatusException;

public class AmfTest {
	
	public static void main(String args[]){
		AMFConnection conn=new AMFConnection();
		try {
			conn.connect("http://localhost:8400/amfClient_java/messagebroker/amf");
			try {
				Object obj=conn.call("testAmf.getName", "name");//第一个参数是 destination.方法名,第2参数是方法参数
				
				System.out.println(obj.toString());
			} catch (ServerStatusException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} catch (ClientStatusException e) {
		
			e.printStackTrace();
		}
	}
}
调用输出namehehe

 

<destination id="testAmf">
		 
        <properties>
            <source>test.Hello</source>
         	
        </properties>
    
	</destination>

 

你可能感兴趣的:(java,.net,Flex,Blog)