blob: d7080da138e94341b41641c5a8f18875f9aca1b6 [file] [log] [blame]
Bryan Duxburydef30a62009-04-08 00:19:37 +00001Thrift Erlang Software Library
2
3License
4=======
5
6Licensed to the Apache Software Foundation (ASF) under one
7or more contributor license agreements. See the NOTICE file
8distributed with this work for additional information
9regarding copyright ownership. The ASF licenses this file
10to you under the Apache License, Version 2.0 (the
11"License"); you may not use this file except in compliance
12with the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16Unless required by applicable law or agreed to in writing,
17software distributed under the License is distributed on an
18"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19KIND, either express or implied. See the License for the
20specific language governing permissions and limitations
21under the License.
22
23Example
24=======
25
David Reiss702019c2008-06-11 00:58:13 +000026Example session using thrift_client:
27
David Reiss3f660a42010-08-30 22:05:29 +0000281> {ok, C0} = thrift_client_util:new("localhost", 9090, thriftTest_thrift, []), ok.
29ok
302> {C1, R1} = thrift_client:call(C0, testVoid, []), R1.
David Reiss702019c2008-06-11 00:58:13 +000031{ok,ok}
David Reiss3f660a42010-08-30 22:05:29 +0000323> {C2, R2} = thrift_client:call(C1, testVoid, [asdf]), R2.
David Reiss702019c2008-06-11 00:58:13 +000033{error,{bad_args,testVoid,[asdf]}}
David Reiss3f660a42010-08-30 22:05:29 +0000344> {C3, R3} = thrift_client:call(C2, testI32, [123]), R3.
David Reiss702019c2008-06-11 00:58:13 +000035{ok,123}
David Reiss3f660a42010-08-30 22:05:29 +0000365> {C4, R4} = thrift_client:call(C3, testOneway, [1]), R4.
David Reiss702019c2008-06-11 00:58:13 +000037{ok,ok}
David Reiss3f660a42010-08-30 22:05:29 +0000386> {C5, R5} = thrift_client:call(C4, testXception, ["foo"]), R5.
David Reiss702019c2008-06-11 00:58:13 +000039{error,{no_function,testXception}}
David Reiss3f660a42010-08-30 22:05:29 +0000407> {C6, R6} = thrift_client:call(C5, testException, ["foo"]), R6.
David Reiss702019c2008-06-11 00:58:13 +000041{ok,ok}
David Reiss3f660a42010-08-30 22:05:29 +0000428> {C7, R7} = (catch thrift_client:call(C6, testException, ["Xception"])), R7.
43{exception,{xception,1001,<<"Xception">>}}
Anthony F. Molinaroa6530672011-09-18 04:57:50 +000044
45Notes
46=====
47To use the JSON protocol client, you will need jsx. This will be pulled in
48via rebar for building but not automatically installed by make install.