DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Next Evolution in Integration: Architecting With Intent Using Model Context Protocol
  • Integrating Model Context Protocol (MCP) With Microsoft Copilot Studio AI Agents
  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • IoT Communication Protocols for Efficient Device Integration

Trending

  • AI Speaks for the World... But Whose Humanity Does It Learn From?
  • Simpler Data Transfer Objects With Java Records
  • The Future of Java and AI: Coding in 2025
  • Implementing Explainable AI in CRM Using Stream Processing

Hessian Web Service Protocol - Hello World Example

By 
Peter Karussell user avatar
Peter Karussell
·
Apr. 13, 09 · Interview
Likes (0)
Comment
Save
Tweet
Share
29.8K Views

Join the DZone community and get the full member experience.

Join For Free

yesterday i took a quick look to the binary communication protocol: hessian . with hessian your admins will not have any troubles with port-activation for your (’desktop’) application, if they have to access remote services (db etc.).

the java implemenation from caucho is released under the apache license 2.0. hessian is well integrated into spring and seems to perform well for version 3.2 (one year old!). an orm tool which supports hessian out of the box is cayenne .

example

now to our hello world example. it is a maven project and you can get it from here (public domain of course …).

if you don’t want to use maven you should get the following jars:
hessian-libs

but maybe you have the same problems with downloading a none-corrupted hessian.jar from caucho (why that?) - then you will be forced to install maven or netbeans.

the usage is simple: in netbeans you can directly open maven projects with the maven plugin. then start the jetty-server: go into the myservlet class and press shift+f6. you should see in the output window:
… info:  logging to stderr via org.mortbay.log.stderrlog
… info:  jetty-6.1.16
… info:  started socketconnector@0.0.0.0:8080

then go to the client class and press shift+f6. you should see a new window coming up:

hessian-client

change the text and press enter will push the text to the server and get the response text at the bottom of the window updated:
hessian-client-result

now let us understand what is necessary:

  1. an interface which has to be available on the server and on the client side:
    public interface communicationservice {    string communicate(string str);}
  2. an implementation of this interface on the server side:
    public class myservlet extends hessianservlet implements communicationservice {    public string communicate(string str) {        return "hello world! " + str;    }    ...}
    (here only the ‘implements communicationservice’ is important)
  3. now the server code:
    public static void main(string[] args) throws exception {        server server = new server(8080);        context context = new context(server, "/", context.sessions);        context.addservlet(myservlet.class, "/communication-service");        server.start();}
  4. and the client code:
    string url = "http://localhost:8080/communication-service";hessianproxyfactory factory = new hessianproxyfactory();final communicationservice basic = (communicationservice) factory.create(communicationservice.class, url);...resultlabel.settext("server said : " + basic.communicate(field.gettext()));
  5. thats it!

looks really like rpc of java but it is language independent - there are implementations for ruby, phyton … and it seems to be more performant than language independent solutions like xml-rpc. are there other advantages or disadvantages?

Web Service Hessian (Web service protocol) Protocol (object-oriented programming)

Opinions expressed by DZone contributors are their own.

Related

  • Next Evolution in Integration: Architecting With Intent Using Model Context Protocol
  • Integrating Model Context Protocol (MCP) With Microsoft Copilot Studio AI Agents
  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • IoT Communication Protocols for Efficient Device Integration

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!