HessianObjC is a pre-ARC Objective-C framework that speaks the Hessian 1.x binary remote procedure call (RPC) protocol. Use it to encode Objective-C data structures, post requests to Hessian services, and decode responses while preserving legacy macOS compatibility.
- 2001: Caucho Technology introduced the Hessian binary protocol to simplify service-to-service communication without SOAP’s XML overhead.
- Early 2000s: Java and PHP libraries shipped first, delivering language-agnostic RPC with compact binary framing and automatic typing.
- Mid 2000s: Objective-C and other community ports appeared, enabling native apps to talk to the growing ecosystem of Hessian services.
Today Hessian remains attractive for legacy integrations where compact cross-language RPC is required without adopting gRPC or JSON-based stacks.
- Targets macOS 10.4-era APIs: manual retain/release,
NSURLConnection, andNSCalendarDateremain in active use. - Encodes outbound payloads via
BBSHessianEncoder, posts them withBBSHessianProxy, and decodes responses viaBBSHessianDecoderandBBSHessianResult. - Supports custom Objective-C ↔ Hessian class mappings so complex objects round
trip cleanly using
NSCoding. - Ships with SenTestingKit-based integration tests that exercise the public API against Caucho’s public Hessian test endpoint.
BBSHessianEncoder: Converts Foundation objects into Hessian byte streams. Handles chunked strings/data (0x8000-byte segments) and manual class-cluster inspection (NSCFString,NSCFDictionary, etc.).BBSHessianDecoder: Parses Hessian replies, manages reference tables, and rehydrates objects viaBBSHessianMapDecoderwhen class mappings exist.BBSHessianProxy: Synchronous client that wrapsBBSHessianCall, posts withtext/xmlheaders, and returns decoded objects orNSErrorinstances.BBSHessianInvocation: Asynchronous variant acting as anNSURLConnectiondelegate, calling back with decoded responses or errors.
xcodebuild -project HessianObjC.xcodeproj -alltargets- The bundled
build.xmlmirrors these steps for Ant-based workflows:
ant distRun the SenTestingKit suite (hits http://hessian.caucho.com/test/test):
xcodebuild \
-project HessianObjC.xcodeproj \
-target HessianObjTest \
-configuration Debug \
-sdk macosxNetwork failures will surface as test errors; rerun when the external service is reachable.
NSURL *url = [NSURLURLWithString:@"http://www.caucho.com/hessian/test/basic"];
BBSHessianProxy *proxy = [[[BBSHessianProxy alloc] initWithUrl:url] autorelease];
NSNumber *a = [NSNumbernumberWithInt:1130];
NSNumber *b = [NSNumbernumberWithInt:551];
id result = [proxy callSynchronous:@"subtract"withParameters:@[a, b]];
NSLog(@"subtract => %@", result);NSDictionary *mapping = [NSDictionarydictionaryWithObject:@"TestObject"forKey:@"com.example.TestObject"];
[BBSHessianProxy setClassMapping:mapping];
TestObject *obj = [[[TestObject alloc] init] autorelease];
[obj setFname:@"Byron"];
[obj setLname:@"Wright"];
NSMutableData *data = [BBSHessianEncoder dataWithRootObject:obj];
id decoded = [BBSHessianDecoder decodedObjectWithData:data];- All custom classes must implement
NSCodingto encode/decode via Hessian maps. Seetests/TestObject.mfor a minimal example. BBSHessianProxy callSynchronous:returns either the decoded object or anNSError; callers should check the type before use.- Be mindful of manual memory management; follow the retain/release patterns shown throughout the codebase.
tests/BBSHessianTest.m: Demonstrates encoder/decoder round trips, remote calls, and class mapping.examples/SimpleAppTest/: Simple Cocoa application project that consumes the framework.
HessianObjC is licensed under the Apache License, Version 2.0. See LICENSE
for details.