Hi
I have generated the python skeletons from files in [1] and tried to write
a python client. When running the client following error occurred,
File "PythonClient.py", line 52, in <module>
client.connect('admin','admin')
File
"gen-py/ThriftSecureEventTransmissionService/ThriftSecureEventTransmissionService.py",
line 92, in connect
return self.recv_connect()
File
"gen-py/ThriftSecureEventTransmissionService/ThriftSecureEventTransmissionService.py",
line 104, in recv_connect
(fname, mtype, rseqid) = self._iprot.readMessageBegin()
File
"/home/dinesh/cartridge-agent/examples/carbon/thrift/protocol/TBinaryProtocol.py",
line 140, in readMessageBegin
name = self.trans.readAll(sz)
File
"/home/dinesh/cartridge-agent/examples/carbon/thrift/transport/TTransport.py",
line 58, in readAll
chunk = self.read(sz - have)
File
"/home/dinesh/cartridge-agent/examples/carbon/thrift/transport/TTransport.py",
line 159, in read
self.__rbuf = StringIO(self.__trans.read(max(sz, self.__rbuf_size)))
File
"/home/dinesh/cartridge-agent/examples/carbon/thrift/transport/TSocket.py",
line 118, in read
message='TSocket read 0 bytes')
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes
Seems like the connect function could not be accessed.
Any idea on this?
[1]
https://svn.wso2.org/repos/wso2/carbon/platform/branches/turing/components/data-bridge/org.wso2.carbon.databridge.commons.thrift/4.2.0/src/main/resources/
Thanks
--
*Dinesh Bandara*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import sys, glob
sys.path.append('gen-py')
from ThriftSecureEventTransmissionService import ThriftSecureEventTransmissionService
from ThriftSecureEventTransmissionService.ttypes import *
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
# Make socket
socket = TSocket.TSocket('10.100.0.140', 7711)
# Buffering is critical. Raw sockets are very slow
transport = TTransport.TBufferedTransport(socket)
# Wrap in a protocol
protocol = TBinaryProtocol.TBinaryProtocol(transport)
# Create a client to use the protocol encoder
client = ThriftSecureEventTransmissionService.Client(protocol)
socket.open()
# Connect!
transport.open()
Id = client.connect('admin','admin')
transport.close()
socket.close()
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev