HESSIAN VC + + client and Java server-side communication implementation __python

Source: Internet
Author: User
Hessian VC + + client and Java server-side communication implementation

Recently encountered a project, need to communicate with the Java server side, the Java server uses the protocol is Hessian. Have not heard, Google to find its official website (http://hessian.caucho.com/) briefly, similar to the C # Web servers, binary Web services, Google again, more efficient than the Web servers and socket almost.

The Official document support C + + implementation (do not support you ya also bashful) under the source code roughly looked, Baidu A, Support Hessian support HTTP protocol, the Protocol is encapsulated in the HTTP packet, through the HTTP channel transmission.     Because he uses binary code without extra data, the amount of data is much less than the SOAP protocol (the project also uses the SOAP protocol). Since the support HTTP protocol, I would like to support of course, MFC inside the package of good HTTP class library to deal with CHttpConnection and CInternetSession looked at the next Hessian source code is simply loaded into the string for conversion and then post to the service side, A demo to change, a tune service end return is really returned, but returned is 500 error (unknown server error), looking for half a day also do not know what reason, continue Google, found curl this good dongdong (http://curl.haxx.se/), Support for Dict, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, Imaps, Ldap,ldaps, POP3, Pop3s, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS this multi-association On. This NB, but elder brother won't use AH. Also have to look at the example, the next demo well, with a tune, the service end of a tune can be. Finish the nonsense and get to the point. The main processes are as follows:

Call Start_call to run a character conversion on the method name to be invoked remotely, depending on the Hessian source

Call Set_parameter (Mc,param) to convert the parameter string and to stitch the converted remote method name.

Call Complete_call (string strparam) to set the end identifier for the string plus Z

Outgoing data is ready to be completed. The protagonist debut Curl

Call curl_easy_setopt to set Curlopt_url curlopt_postfields separately, curlopt_postfieldsize parameter meaning see the official website,

_res=curl_easy_perform (_curl) sends HTTP packets to the remote Web site

Returns the function that succeeds in calling Hessian_input to receive data

auto_ptr<input_stream> sis (New String_input_stream (_http_result));

Hessian_input hes_in (SIS);

Hes_in.start_reply ();

result = Hes_in.get_result ();

Hes_in.complete_reply ();

Okay, it's over. It's easy to look at it, it's not too hard, it's mainly not known before and curl this stuff. If you need help, please email me luoj166@163.com. Next Write VC + + invoke Java webservers with HTTP header validation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.