Parsing a .NET DataSet returned from a .NET Web Service in Java

前端 未结 3 999
心在旅途
心在旅途 2020-12-28 17:54

I have to consume a .NET hosted web service from a Java application. Interoperability between the two is usually very good. The problem I\'m running into is that the .NET ap

相关标签:
3条回答
  • 2020-12-28 18:05

    Have you considered using XSLT on the raw XML returned to massage it into something you can handle more easily?

    I've used that approach to convert a complex return value into something similar to

    <ops>
      <set name="foo" value="bar"/>
      <set name="foo2" value="bar2" />
      ....
     </ops>
    

    This moves the logic into a language well suited to process XML instead of handcoding it in Java.

    0 讨论(0)
  • 2020-12-28 18:09

    Unfortunately I don't think there's an easy answer here. What I would do is create a Proxy web service in .NET that you could call from Java that would receive the dataset, transform it into something more consumable and then return that to your Java code.

    0 讨论(0)
  • 2020-12-28 18:14

    Is your Java application running on a server? If so, install Mono on the server and use ADO.NET built into Mono to convert the Dataset into something Java can understand. The advantage is that all the interpretation of the Dataset is done for you in Mono. You can even use IKVM to stay in the Java language world. Anyway, in the Mono world you can have a local service which can do the conversion, or simply have a utility that converts the Dataset into the file system in a format that Java can understand.

    0 讨论(0)
提交回复
热议问题