我需要使用网络服务(.Net asmx),其中很少有方法接受.Net 对象作为参数。例如,一种方法具有以下签名:
public Item SaveData(string itemName, string guid, Location storeAddress, Price price)
前 2 个参数是简单的对象(字符串),因此发送到 WS 没有什么特别的。我的问题是最后两个参数。该位置在.Net上定义为:
public class Location
{
    double longitude, latitude;
    public Location()
    {
    }
    public Location(double longitude, double latitude)
    {
        this.Longitude = longitude;
        this.Latitude = latitude;
    }
    public Location(String longitude, String latitude)
    {
        this.Longitude = double.Parse(longitude);
        this.Latitude = double.Parse(latitude);
    }
    public double Longitude
    {
        get { return longitude; }
        set { longitude = value; }
    }
    public double Latitude
    {
        get { return latitude; }
        set { latitude = value; }
    }
}
和价格之类的 //不是所有的代码
public class Price {
    //private vars
    public Price(float price, float discount, string currency){
        //vars assignment 
    }
//more methods and properties
}
现在在 Java (android) 上,我使用 HttpClient 和 HttpParams 来发送发布数据。
我的问题是: 1. 如何构建 JSON 以将所需参数发送到服务器?2.有什么工具可以帮助我构建请求吗?我正在寻找知道阅读 wsdl 并构建示例请求的东西。
谢谢你。