here is a sample python code.
meta = Meta()
meta.sourcePlatform = get_source_platform(iDict['source_platform'])
request.meta = (meta)
if iDict.has_key('skipformat'):
request.skipFormat = iDict['skipformat']
if iDict.has_key('ignorecase'):
request.ignoreCase = iDict['ignorecase']
#input and output File related
#these fields are mandatory
iSource = InputSource()
iSource.filePath = iDict['inputfile']
oSource = ResultOutputSource()
oSource.filePath = iDict['outputfile']
request.inputSource = (iSource)
request.outputSource = (oSource)
#tenantid, entityid and other fields
if iDict.has_key('entityid'):
request.entityId = iDict['entityid’]
request.targetPlatform = get_target_platform(iDict['target_platform’])
request.fsmMeta = buildFSMMeta()
# Make socket
transport = TSocket.TSocket('localhost', 12121)
# Buffering is critical. Raw sockets are very slow
transport = TTransport.TBufferedTransport(transport)
# Wrap in a protocol
protocol = TBinaryProtocol.TBinaryProtocol(transport)
# Create a client to use the protocol encoder
client = QueryCompilerService.Client(protocol)
# Connect!
transport.open()
resp = client.service1(req)
if resp == None:
raise ValueError(“Error")
print 'status returned is %s' % resp.isSuccess
# Close!
transport.close()
return resp
the target platform and fsmmeta are coming as null in java server.
If i build the same in a java client and pass it to java server, they are
received fine.
i am using thrift 0.9.3
regards,
sandeep
> On Dec 16, 2015, at 11:35 AM, Jens Geyer <[email protected]> wrote:
>
> Hi Sandeep,
>
> thanks, looks good to me so far.
>
> a) How do you do the call /exactly/ and
> b) which of these args do you receive on the server end, and which are null?
>
>
> Have fun,
> JensG
>
> -----Ursprüngliche Nachricht----- From: Sandeep Akinapelli
> Sent: Wednesday, December 16, 2015 9:26 AM
> To: [email protected]
> Subject: Re: server side value is null
>
> Here it is. I am supplying the target platform field for service2 function,
> but inside the handler class at server side, the target platform field has
> null value.
>
> namespace java xxx
> namespace py xxx
>
>
> enum SourcePlatform {
> xxx = 1,
> abc = 2,
> }
>
> enum Compiler {
> xxx = 1,
> }
>
> enum TargetPlatform {
> xxx = 1,
> }
>
> union InputSource {
> 1: string filePath,
> 2: string xxx
> }
>
> union ResultOutputSource {
> 1: string filePath,
> 2: bool embedInResponse = true
> }
>
> struct Meta {
> 1: required SourcePlatform sourcePlatform,
> 2: required Compiler compiler
> }
>
> struct FSMMeta {
> 1: optional string xxx,
> }
>
> struct Request {
> 1: required Meta meta,
> 3: required string entityId,
> 4: required string tenantId,
> 5: required InputSource inputSource,
> 6: required ResultOutputSource outputSource,
>
> 8: optional bool ignoreCase = true
> 9: optional string version = "1";
> 10: optional TargetPlatform targetPlatform,
> 11: optional FSMMeta fsmMeta,
> }
>
> struct Result {
> 1: bool isSuccess,
> 2: string result
> }
>
> exception InvalidValueException {
> 1: i32 error_code,
> 2: string error_msg
> }
>
>
> exception InvalidRequestException{
> 1: i32 error_code,
> 2: string error_msg
> }
>
> service CService {
> string ping(),
> Result service1(1: Request request) throws (1: InvalidRequestException e)
> Result service2(1: Request request) throws (1: InvalidRequestException e)
> }
>
>
>> On Dec 16, 2015, at 12:12 AM, Jens Geyer <[email protected]> wrote:
>>
>> Yes, some code would be great. Start with the IDL.
>> ________________________________
>> Von: Sandeep Akinapelli
>> Gesendet: 16.12.2015 08:54
>> An: [email protected]
>> Betreff: server side value is null
>>
>> I am using python client and java server with TBinaryProtocol. When I am
>> printing the thrift object at client side, i see few parameters and the same
>> parameters are coming as null at server side. has any one seen this type of
>> strange behavior.
>>
>> I can provide the code and thrift files if needed.
>>
>> regards,
>> sandeep
>