调用从.net使用名单,其中的Java Web服务; T>名单、net、Java、GT

2023-09-04 02:37:21 作者:笑该动人

我正在开发将由.NET客户端消耗一个Java Web服务。该服务公开接受一个对象作为参数的方法,这个对象有一个List类型的字段,行类也有一个List类型的字段。

I'm developing a Java web service that will be consumed by .Net clients. The service exposes a method that accepts an object as an argument, this object has a field of type List, the Row class also has a field of type List.

现在,当为Java客户端消耗的这项服务是正确看到了类型为列表然而,当.NET客户端消耗了我结束了通话期望类型值的数组的数组的服务(例如值[] []),而不是列表。

Now when as Java client consumes this service it correctly sees the types as List however when a .Net client consumes the service I end up with the call expecting an array of arrays of type Value (e.g. Value[][]) instead of List.

版本的兼容性已被设置为净3.5 / 1.3麦德龙。

The version compatibility has been set to ".Net 3.5/METRO 1.3".

有谁知道我怎么能得到这个与.NET和Java的客户端在相同工作,他们接受列表,而不是值[] []?

Does anyone know how I can get this to work the same with .Net and Java clients in that they accept List instead of Value[][]?

Web服务的砍掉版本是:

Cut down versions of the web service are:

服务:

    @WebService(serviceName = "Test")
    public class Test {

    @WebMethod(operationName = "DataRequest")
    public DataResponse DataRequest(DataRequest req) {
        return new DataResponse();
    } 

}

DataRequest:

DataRequest:

public class DataRequest {
    public DataType datType;
    public String source;
    public List<RowInfo> rows;
    public String loginId;
}

RowInfo:

RowInfo:

public class RowInfo {
   public List<Value> valueList;
}

值:

public class Value {    
    public String name;
    public String value;
}

在我的.Net客户端,当我尝试建立请求对象它看到FeeDataRequest的行字段[] []的值,而不是列表。

On my .Net client when I try and build the request object it sees the rows field of FeeDataRequest as Value[][] instead of List.

在.NET中的服务引用已配置,以便集合类型System.Collections.Generic.List。

The service reference in .Net has been configured so that the collection type is System.Collections.Generic.List.

就如何使净任何想法,认为这是否正确?

Any idea on how to make .Net sees this correctly?

推荐答案

使用 JSON 或的 XML 您的服务之间发送数据。

Use json or xml to send data between your services.