I am using webservice. I am getting data to Java in the form of C# dataset how to retrieve values from dataset in Java.
I've handled this by using XPath with Xalan to query the DOM document that Axis hands to me. The schema of the serialized DataSet is pretty clear and easy to query. I just had to be sure to set up Xalan with the proper namespaces to perform the queries.
I ran into one problem handing the data this way. The serialized DataSet doesn't contain an element for data that is null. If you know what data you are expecting then this isn't a problem. However, if you don't know exactly what data to expect, you can extract the fields that are in the DataSet from the XML document.
Does this mean you are using the web service to transport the actual DataSet object?
Just convert the C# data set to xml or a formatted string on the C# side before it gets sent to the web service. Then you can easily re-parse the web service output into whatever java object you want. (I would just go with a formatted string, I havent used any Java XML libraries that come CLOSE to being as good as C#'s XDoc).
A dataset is serialized as XML. You will have to create an XML object on the Java side and consume it by binding the XML to items in your application. For simple report output, XSLT would help to simply the work.
Try to stay away from anything that's .NET-specific. Don't return a DataSet, for instance. Stick to using simple types, arrays and structs of simple types, and you'll be fine.
It depends on the format of the webservice. If it's a SOAP service look to a prior SO answer: consuming-a-web-service-in-java
If it's restful. I'd suggest using JSON if possible because the JSON serializer on the .Net side generally gives you a more agnostic serialization. Then, Java-side httpclient gives you a robust way to connect, and Json-lib lets you parse, rock, and roll.