Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6103665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:45:17+00:00 2026-05-23T13:45:17+00:00

There is a Java service that I need to invoke from PHP that looks

  • 0

There is a Java service that I need to invoke from PHP that looks something like this:

getProductsForMode(java.util.Calendar date, int modeId)

I’m having trouble mapping my PHP date class to the java.util.Calendar class. I’ve tried a couple different approaches, all to no avail:

Approach #1 (wrapping DateTime object in a CalendarHandle that gets mapped to Java’s CalendarHandle):

class CalendarHandle
{
  public $type;
  public $date;

  function __construct($date=null)
  {
    $this->date = $date;
  }
}

$this->hessianClient = new HessianClient(_HESSIAN_ENDPOINT, $hessianOptions);
$config = &HessianConfig::globalConfig();
$config->typeMap->mapRemoteType('com.caucho.hessian.io.CalendarHandle', 'CalendarHandle');

$time = new CalendarHandle(new DateTime($dateEvaluated));
$products = $this->hessianClient->getProductsForMode($time, 1234);

Error:

[06-Jul-2011 11:16:52] PHP Fatal
error: Uncaught exception ‘HttpError’
with message ‘HttpError: Malformed
HTTP header’ in
/Users/jordanb/Sites/proposal-framework/trunk/plugins/srHessianClientPlugin/hessianphp/Http.php:265

Approach #2:
Mapping DateTime to java.util.Calendar

$this->hessianClient = new HessianClient(_HESSIAN_ENDPOINT, $hessianOptions);
$config = &HessianConfig::globalConfig();
$config->typeMap->mapRemoteType('java.util.Calendar', 'DateTime');

$time = new DateTime($dateEvaluated);
$products = $this->hessianClient->getProductsForMode($time, 1234);

Error:

[06-Jul-2011 11:28:50] PHP Fatal error: Uncaught exception ‘HessianError’ with message ‘Hessian Parser, Malformed reply: expected r’ in /Users/jordanb/Sites/proposal-framework/trunk/plugins/srHessianClientPlugin/hessianphp/Protocol.php:350

Has anyone had success sending a DateTime or some sort of timestamp from PHP to Java using Hessian? Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:45:17+00:00Added an answer on May 23, 2026 at 1:45 pm

    Would it be practical to just use the php time() function (which returns an int and send this as a long to Java? In Java you could just pass the long to new Date(long Date).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need something like the C function getservbyname() for a Java application. I've got
We are busy developing a Java web service for a client. There are two
Is there a Java package providing funcionality like the .Net System.Data namespace ? Specificaly
Is there any Java library that supports hierarchical column? For example (the first three
Are there any libraries out there for Java that will accept two strings, and
In Java is there a way to check the condition: Does this single character
I'm currently building a Java daemon that will need to be able to sign
I'm working on a Wake on LAN service that will run from a web
My iPhone app will be receiving an xml feed from a Java web service.
I am writing a Java Rest Web Service and need the caller's IP Address.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.