简体   繁体   中英

Java client for C++ web service

Recently I came across a question while browsing over the internet which left me perplexed. The question is

Can a Java client talk to C++ Server using Web Service ?

I have seen the other way round, a Java Web service and a C# client for example. But no clue about this one. Also I have heard of gSOAP standard which is the industry standard for C/C++ web services. However, that does not answer my question.

Would like some insight into this.

Thanks Heena

Since nowadays the most so called web services are plattform and language independent - the answer is "yes". A java client can talk to a C++ Server via. Webservice. The most common techniques are

  • SOAP Simple Object Access Protocoll (Based on XML) or a
  • REST based Webservice

both normally use HTTP to manage the connection and the conversation.

如果它是基于SOAP的Web服务,您可以在服务WSDL上指向wsimport之类的工具来生成客户端存根。

SOAP is an industry standard for ALL languages. The document being sent with SOAP is XML which is text, so as long as the language has an XML parser to marshal and unmarshal the XML it will work. Java is well equipped as far as this goes.

In fact, if it is an kind of a programming language you don't even need a built in parser, you can write the parser code yourself if you are game. All it needs is the ability to read a file stream and the ability to access a network socket.

So yes, a Java client can talk to a web service running on a host that has been compiled with C# or C++ or C or whatever. As long as it is a standards based web service.

Java, can also communicate with C/C++ through native calls (via the 'native' Java libary), and can also talk to C/C++ using CORBA.

There are all kinds of options for Java and C/C++ to talk to each other.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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