???????????????????????????????????????Serializable????
HelloBean.java
package hessian.test.server;
import java.io.Serializable;
public class HelloBean implements Serializable {
private static final long serialVersionUID = 570423789882653763L;
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge(){
return age;
}
public void setAge(int age){
this.age = age;
}
}
ComplexData.java
package hessian.test.server;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class ComplexData implements Serializable{
private static final long serialVersionUID = 1L;
private ArrayList<HelloBean> helloBeans;
//private Map<String?? HelloBean> helloBeanMap;
private int number;
public int getNumber(){
return number;
}
public ArrayList<HelloBean> getHelloBeans(){
return helloBeans;
}
public void setData(ArrayList<HelloBean> beans?? int num){
this.number = num;
this.helloBeans = beans;
//        helloBeanMap = new HashMap<String?? HelloBean>();
//        for (HelloBean helloBean : beans) {
//            if(!helloBeanMap.containsKey(helloBean.getName()))
//            {
//                helloBeanMap.put(helloBean.getName()?? helloBean);
//            }
//        }
}
}
????web.xml?????
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>hessian server</display-name>
<servlet>
<servlet-name>hessian</servlet-name>
<servlet-class>com.caucho.hessian.server.HessianServlet</servlet-class>
<init-param>
<param-name>service-class</param-name>
<param-value>hessian.test.server.HelloImpl</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>hessian</servlet-name>
<url-pattern>/hessian</url-pattern>
</servlet-mapping>
</web-app>
????Hessian??????c#??
?????????????????????IHello????IHello.cs
????public interface IHello
????{
????String sayHello(String msg);
????void sayHello2(int bean);
????void print(String msg);
????HelloBean getData(HelloBean bean);
????HelloBean[] getBeanList();
????ComplexData getComplexData();
????}
???????????????????μ???????????
HelloBean.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace hessian.test.server
{
public class HelloBean
{
public String Name
{
set { name = value; }
get { return name; }
}
private String name; //????????????????????????
public int Age
{
set { age = value; }
get { return age; }
}
private int age; //????????????????????????
public override String ToString()
{
return "Name: "+ name + " Age: " + age;
}
}
}
ComplexData.cs??
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace hessian.test.server
{
public class ComplexData
{
private HelloBean[] helloBeans;
//private Dictionary<String?? HelloBean> helloBeanMap;
private int number;
public int GetNumber()
{
return number;
}
public HelloBean[] GetBeans()
{
return helloBeans;
}
//public Dictionary<String?? HelloBean> GetBeansDic()
//{
//    return helloBeanMap;
//}
}
}