简体   繁体   English

如何将MultiMap .Net转发到Java?

[英]How to forward MultiMap .Net to Java?

I am currently working on an application which needs to send MultiMap from .Net to Java. 我目前正在开发一个需要将MultiMap从.Net发送到Java的应用程序。 I am currently using "org.apache.commons.collections.MultiMap" in Java to read details from MultiMap and thinking to use MultiMap class in C# to forward the details from .Net to Java. 我目前在Java中使用“ org.apache.commons.collections.MultiMap”从MultiMap中读取详细信息,并考虑在C#中使用MultiMap类将详细信息从.Net转发到Java。

I would like to forward MultiMap from .Net to Java using webservice. 我想使用Web服务将MultiMap从.Net转发到Java。

Can I use this approach to forward the details from .Net to Java (because I need to use one key and multiple values) ? 我是否可以使用这种方法将详细信息从.Net转发到Java(因为我需要使用一个键和多个值)?

If so, can anyone explain the procedure to forward the details ? 如果是这样,任何人都可以解释转发详细信息的过程吗?

If these are two independent applications, there is no way for them to see each others' variables without an explicit communication channel. 如果这是两个独立的应用程序,则没有显式的通信通道就无法查看彼此的变量。 Your best bet is to open some sort of Socket between the two and specify how you want to data over the line to be structured. 最好的选择是在两者之间打开某种Socket,并指定要如何在要构造的行上进行数据处理。

JSON example(you probably don't need to do this manually, check for a library do to the object->JSON conversion. JSON示例(您可能不需要手动执行此操作,请检查是否对对象-> JSON转换执行了操作。

{
    {
        "key":"mykey"
        "values":["val1","val2","val3"]    
    }

    {
        "key":"mykey2"
        "values":["val12","val22","val32"]    
    }
}     

Once you know your data format and have a socket connection, you just need the C# and Java to be able to convert to and from the data format. 一旦知道了数据格式并建立了套接字连接,您只需要C#和Java就能在数据格式之间来回转换。

If you meant javascript interacting with server side C#, there are ways to bind variables but I don't know if they work with complex data types. 如果您是说javascript与服务器端C#进行交互,则可以使用多种方法来绑定变量,但我不知道它们是否适用于复杂的数据类型。 How do you pass variables from c# to javascript? 如何将变量从C#传递到javascript?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM