0

I have two applications: one in C#, the other in Java. I need a way to transfer data from the C# application in XML format to the Java application using some kind of service.

I have only worked with sockets before, but am looking for something less proprietary for future use with other applications. What other alternatives are there?

*Please note that the extent of my knowledge with working with sockets was a simple client/server written in java.

ricgeorge
  • 188
  • 3
  • 5
  • 12
  • 1
    It's hard to know exactly what you're asking here. The obvious option would be to use HTTP, for example... – Jon Skeet Nov 14 '12 at 10:06
  • Basically WSDL based communications is what is required... A previous question discusses that http://stackoverflow.com/questions/1703951/interoperate-between-c-sharp-and-java-using-web-services-without-a-java-ee-appli – AurA Nov 14 '12 at 10:06
  • Here is [an example](http://stackoverflow.com/questions/13165533/deserialize-json-object-sent-from-android-app-to-wcf-webservice) using WCF+Json+Java – L.B Nov 14 '12 at 10:54

2 Answers2

2

If both programs run on the same machine, you could of course also use files, but in general, this is how it goes down:

  1. Create a webservice in C#, implementing a method that exposes your data.
  2. Use the wsimport tool provided with the jdk, point it at the above created .wsdl file to generate java classes to use as a soap client.
  3. Use generated classes to consume webservice.
mindandmedia
  • 6,800
  • 1
  • 24
  • 33
  • This sounds like it has potential. I'll have to do more research on how to implement a web service in C# to give it a try – ricgeorge Nov 14 '12 at 10:26
1

(I see now you insist on XML. So forget about it)

These are completely distinct issues - it's like asking if I want to speak with you now, should we have a phone call in French or maybe mail correspondence in Mandarin. So it's:

  1. Means of transferring data (S.A HTTP, or TCP, or whatever).

  2. Some common structure of data.

Confusingly, both are regarded as 'protocols'.

Anyhow I'd say protobuf over HTTP is the most obvious and straight forward thing to use.

avishayp
  • 706
  • 5
  • 9
  • The common structure is indeed XML, but it's the means of transferring that data that I need and do not understand. I need it to be compatible with both programming languages, as well as being capable of understanding XML format – ricgeorge Nov 14 '12 at 10:36
  • What you need is called *HTTP*, and is supported by anything nowadays. – avishayp Nov 14 '12 at 11:05