Hi Chuck

The problem is that the Java service expects the second parameter to be an
object of type InternetAddress and you are sending a string. In order to
solve this you have to send a PHP object compatible with InternetAddress so
the Java deserializer can make the translation. This code should work, I
just tested it with the latest HessianPHP from google code:

// Create a simple typeless object which loosely corresponds to the
InternetAddress class in Java
$param = new stdClass();
$param->address = '[email protected] <[email protected]>e'; //
public property exposed by the Java class, needed in your case

$client = new HessianClient('http://url_of_your_service');
$result = $client->subscribeEmail(4, $param, 0, 0);
var_dump($result); // compare this with the AuthSubscribeResult Java class

You could go crazy and create a class that looks exactly like the
InternetAddress thing, then map the corresponding types and etc.
But this should be enough to make the service work.

Take into consideration that in some cases (ex. Spring enabled Hessian
services), if the types of the parameters you send do not match *exactly*
those in the the Java end, the service will send an empty reply, and the
Java server will silently throw a really nasty exception.

Hope this helps.

Manolo

2010/6/10 <[email protected]>

> Send hessian-interest mailing list submissions to
>        [email protected]
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://maillist.caucho.com/mailman/listinfo/hessian-interest
> or, via email, send a message with subject or body 'help' to
>        [email protected]
>
> You can reach the person managing the list at
>        [email protected]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of hessian-interest digest..."
>
>
> Today's Topics:
>
>   1. mapping error (Charles Williams)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 10 Jun 2010 10:23:14 +0200
> From: Charles Williams <[email protected]>
> Subject: [Hessian-interest] mapping error
> To: [email protected]
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> hey all,
>
> I think I am having a problem with mapping.
>
> the following generates an error in Resin when executed (HessianPHP):
>
> $subscribe = new subscribeEmail();
> $subscribe = $proxy->subscribeEmail(4, '[email protected]', 0, 0);
>
>
> the class in the java app is:
>
> /* (non-Javadoc)
>  * @see org.subethamail.core.admin.i.Admin#subscribeEmail(java.lang.Long,
> javax.mail.internet.InternetAddress, boolean, boolean)
> */
> public AuthSubscribeResult subscribeEmail(Long listId, InternetAddress
> address, boolean ignoreHold,
> boolean silent) throws NotFoundException
> {
>        EmailAddress addy = this.establishEmailAddress(address, null);
>
>        SubscribeResult result = this.subscribe(listId, addy.getPerson(),
> addy, ignoreHold, silent);
>
>        return new AuthSubscribeResult(
>                        addy.getPerson().getId(),
>                        addy.getId(),
>                        addy.getPerson().getPassword(),
>                        addy.getPerson().getRoles(),
>                        result,
>                        listId);
> }
>
>
> the error:
>
>
> [10-06-10 10:17:30.832] {http--8080-22} javax.servlet.ServletException:
> com.caucho.hessian.io.HessianProtocolException: expected map/object at
> java.lang.String
> ([email protected])
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:424)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.server.dispatch.WebServiceFilterChain.doFilter(WebServiceFilterChain.java:101)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> org.subethamail.web.util.SetRequestCharsetFilter.doFilter(SetRequestCharsetFilter.java:41)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> org.subethamail.web.util.AbstractFilter.doFilter(AbstractFilter.java:53)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:185)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:264)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:275)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.server.port.TcpConnection.handleRequests(TcpConnection.java:644)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.server.port.TcpConnection$AcceptTask.doAccept(TcpConnection.java:1311)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.server.port.TcpConnection$AcceptTask.run(TcpConnection.java:1252)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:866)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:779)
> [10-06-10 10:17:30.832] {http--8080-22} Caused by:
> com.caucho.hessian.io.HessianProtocolException:
> expected map/object at java.lang.String ([email protected])
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.hessian.io.AbstractDeserializer.error(AbstractDeserializer.java:115)
> [10-06-10 10:17:30.832] {http--8080-22}         at
>
> com.caucho.hessian.io.AbstractMapDeserializer.readObject(AbstractMapDeserializer.java:70)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:1707)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:188)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:110)
> [10-06-10 10:17:30.832] {http--8080-22}         at
> com.caucho.hessian.server.HessianServlet.service(HessianServlet.java:416)
> [10-06-10 10:17:30.832] {http--8080-22}         ... 12 more
>
>
>
>
>
> anyone have an idea of what is going on here? I am NOT a java programmer
> and am totally new to Hessian.
>
> thanks
> chuck
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkwQoO4ACgkQ0RUDxJHrYt5mJgCfR3znFsdUd28Sn+dvjYw8Dhc2
> WQAAoK+veWGrfxCx7y2Kgz5DH2TWexxs
> =M77p
> -----END PGP SIGNATURE-----
>
>
>
>
> ------------------------------
>
> _______________________________________________
> hessian-interest mailing list
> [email protected]
> http://maillist.caucho.com/mailman/listinfo/hessian-interest
>
>
> End of hessian-interest Digest, Vol 46, Issue 4
> ***********************************************
>
_______________________________________________
hessian-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/hessian-interest

Reply via email to