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
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

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • IoT Communication Protocols for Efficient Device Integration
  • Building Custom Tools With Model Context Protocol
  • OPC-UA and MQTT: A Guide to Protocols, Python Implementations

Trending

  • Transforming AI-Driven Data Analytics with DeepSeek: A New Era of Intelligent Insights
  • Why High-Performance AI/ML Is Essential in Modern Cybersecurity
  • Docker Model Runner: Streamlining AI Deployment for Developers
  • Kubeflow: Driving Scalable and Intelligent Machine Learning Systems

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

  • Evolution of Cloud Services for MCP/A2A Protocols in AI Agents
  • IoT Communication Protocols for Efficient Device Integration
  • Building Custom Tools With Model Context Protocol
  • OPC-UA and MQTT: A Guide to Protocols, Python Implementations

Partner Resources

×

Comments

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: