You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by King JKing <be...@gmail.com> on 2011/03/08 09:26:51 UTC
Wrong data return when connect from PHP - Java Thrift Service
Dear all,
I use PHP to get value from my Java Thrift Service (Implement THaHsServer).
Here is my PHP code:
$this->socket = new TSocket($this->_host, $this->_port, true);
$this->transport = new TFramedTransport($this->socket);
$this->protocol = new TBinaryProtocolAccelerated($this->transport);
$this->client = new ServiceReadClient($this->protocol);
But sometimes, PHP get wrong value. I also use Java client to check. Java
client always return right value.
Here is my thrift file
i32 get_point(1:required i32 userId)
I change to:
struct Point{
1:required i32 point
}
Point get_point(1:required i32 userId)
Now PHP always return right value.
That maybe the problem when using PHP to connect to Java Service. Now I
always use Struct for return value instead of primitive value.
Re: Wrong data return when connect from PHP - Java Thrift Service
Posted by King JKing <be...@gmail.com>.
By update server to use Thrift 0.6.0, this problem is resolved.
Thanks
On Wed, Mar 9, 2011 at 5:56 PM, King JKing <be...@gmail.com> wrote:
> I've created this.
>
> https://issues.apache.org/jira/browse/THRIFT-1086
>
>
> On Tue, Mar 8, 2011 at 9:15 PM, Bryan Duxbury <br...@rapleaf.com> wrote:
>
>> Sounds like a bug. Can you open a JIRA ticket?
>>
>> On Tue, Mar 8, 2011 at 12:26 AM, King JKing <be...@gmail.com> wrote:
>>
>> > Dear all,
>> >
>> > I use PHP to get value from my Java Thrift Service (Implement
>> THaHsServer).
>> > Here is my PHP code:
>> > $this->socket = new TSocket($this->_host, $this->_port, true);
>> > $this->transport = new TFramedTransport($this->socket);
>> > $this->protocol = new
>> TBinaryProtocolAccelerated($this->transport);
>> > $this->client = new ServiceReadClient($this->protocol);
>> > But sometimes, PHP get wrong value. I also use Java client to check.
>> Java
>> > client always return right value.
>> >
>> > Here is my thrift file
>> > i32 get_point(1:required i32 userId)
>> >
>> > I change to:
>> > struct Point{
>> > 1:required i32 point
>> > }
>> > Point get_point(1:required i32 userId)
>> > Now PHP always return right value.
>> >
>> > That maybe the problem when using PHP to connect to Java Service. Now I
>> > always use Struct for return value instead of primitive value.
>> >
>>
>
>
Re: Wrong data return when connect from PHP - Java Thrift Service
Posted by King JKing <be...@gmail.com>.
I've created this.
https://issues.apache.org/jira/browse/THRIFT-1086
On Tue, Mar 8, 2011 at 9:15 PM, Bryan Duxbury <br...@rapleaf.com> wrote:
> Sounds like a bug. Can you open a JIRA ticket?
>
> On Tue, Mar 8, 2011 at 12:26 AM, King JKing <be...@gmail.com> wrote:
>
> > Dear all,
> >
> > I use PHP to get value from my Java Thrift Service (Implement
> THaHsServer).
> > Here is my PHP code:
> > $this->socket = new TSocket($this->_host, $this->_port, true);
> > $this->transport = new TFramedTransport($this->socket);
> > $this->protocol = new
> TBinaryProtocolAccelerated($this->transport);
> > $this->client = new ServiceReadClient($this->protocol);
> > But sometimes, PHP get wrong value. I also use Java client to check. Java
> > client always return right value.
> >
> > Here is my thrift file
> > i32 get_point(1:required i32 userId)
> >
> > I change to:
> > struct Point{
> > 1:required i32 point
> > }
> > Point get_point(1:required i32 userId)
> > Now PHP always return right value.
> >
> > That maybe the problem when using PHP to connect to Java Service. Now I
> > always use Struct for return value instead of primitive value.
> >
>
Re: Wrong data return when connect from PHP - Java Thrift Service
Posted by Bryan Duxbury <br...@rapleaf.com>.
Sounds like a bug. Can you open a JIRA ticket?
On Tue, Mar 8, 2011 at 12:26 AM, King JKing <be...@gmail.com> wrote:
> Dear all,
>
> I use PHP to get value from my Java Thrift Service (Implement THaHsServer).
> Here is my PHP code:
> $this->socket = new TSocket($this->_host, $this->_port, true);
> $this->transport = new TFramedTransport($this->socket);
> $this->protocol = new TBinaryProtocolAccelerated($this->transport);
> $this->client = new ServiceReadClient($this->protocol);
> But sometimes, PHP get wrong value. I also use Java client to check. Java
> client always return right value.
>
> Here is my thrift file
> i32 get_point(1:required i32 userId)
>
> I change to:
> struct Point{
> 1:required i32 point
> }
> Point get_point(1:required i32 userId)
> Now PHP always return right value.
>
> That maybe the problem when using PHP to connect to Java Service. Now I
> always use Struct for return value instead of primitive value.
>