NT_
NT_

Reputation: 2670

Cross language C# and Java development

Can you give me some advice on how to best ensure that two applications (one in C#, the other in Java) will be compatible and efficient in exchanging data? Are there any gotchas that you have encountered?

The scenario is point to point, one host is a service provider and the other is a service consumer.

Upvotes: 2

Views: 439

Answers (9)

Jherico
Jherico

Reputation: 29240

If you use XML, you can actually externalize your data access as XPath statements which can be stored in a shared resource used by both applications. That's a start.

Upvotes: 0

Wael Awada
Wael Awada

Reputation: 1526

If you have Java as a webserver, you can use Jax-WS ( https://jax-ws.dev.java.net/ ) to create webservices and WCF for .Net to connect to the Java Webserver..

Upvotes: 2

Ken Wootton
Ken Wootton

Reputation: 1110

Rather than focus on a particular technology, the best advice I can give is spend time focusing on the interface between the two (whether that be a web service, a database, or something else entirely). If it is a web service, for example, focus on creating a clear WDSL document. Interface, interface, interface. For the most part, try to ignore the specific technologies on each end, outside of some prototyping to ensure both languages support your choices.

Also, outside of major roadblocks, don't focus on efficiency. Focus on clarity. You'll likely have two teams (i.e. different people) working on either end of this interface. Making sure they use it correctly is far more important than making things just a little faster.

Upvotes: 2

kgiannakakis
kgiannakakis

Reputation: 104168

Have a look at protobuf data interchange format. A .NET implementation is also available.

Upvotes: 3

northpole
northpole

Reputation: 10346

We use C#/VB.Net for our Web interfaces and Java for our thick client. We use XML and webservices to communicate between the database and application servers. It works very well.

Upvotes: 1

t3rse
t3rse

Reputation: 10124

This is such a broad question but I'd recommend focusing on standards that apply to both platforms; XML or some other standard form of serialization, using REST for services if they need to interoperate.

Upvotes: 0

alphazero
alphazero

Reputation: 27234

JSON for descriptive data, and XML for general data types. If that is not efficient enough for you, you need to roll your own codecs to handle the byte ordering difference between C# and Java.

Upvotes: 3

Alexander Kjäll
Alexander Kjäll

Reputation: 4336

Make sure that you use a well defined protocol in order to communicate the data, and write tests in order to ensure that the applications responds according to contract.

Upvotes: 0

TLiebe
TLiebe

Reputation: 7976

You can use something like XML (which isn't always that efficient) or you need to come up with your own proprietary binary format (efficient but a lot more work). I'd start with XML and if bandwidth becomes a problem, you can always switch to a proprietary binary format.

Something like SOAP (Wikipedia) is supported by both C# and Java.

Upvotes: 1

Related Questions