| Bryan Duxbury | def30a6 | 2009-04-08 00:19:37 +0000 | [diff] [blame] | 1 | Thrift Erlang Software Library | 
|  | 2 |  | 
|  | 3 | License | 
|  | 4 | ======= | 
|  | 5 |  | 
|  | 6 | Licensed to the Apache Software Foundation (ASF) under one | 
|  | 7 | or more contributor license agreements. See the NOTICE file | 
|  | 8 | distributed with this work for additional information | 
|  | 9 | regarding copyright ownership. The ASF licenses this file | 
|  | 10 | to you under the Apache License, Version 2.0 (the | 
|  | 11 | "License"); you may not use this file except in compliance | 
|  | 12 | with the License. You may obtain a copy of the License at | 
|  | 13 |  | 
|  | 14 | http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 15 |  | 
|  | 16 | Unless required by applicable law or agreed to in writing, | 
|  | 17 | software distributed under the License is distributed on an | 
|  | 18 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
|  | 19 | KIND, either express or implied. See the License for the | 
|  | 20 | specific language governing permissions and limitations | 
|  | 21 | under the License. | 
|  | 22 |  | 
|  | 23 | Example | 
|  | 24 | ======= | 
|  | 25 |  | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 26 | Example session using thrift_client: | 
|  | 27 |  | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 28 | 1> {ok, C0} = thrift_client_util:new("localhost", 9090, thriftTest_thrift, []), ok. | 
|  | 29 | ok | 
|  | 30 | 2> {C1, R1} = thrift_client:call(C0, testVoid, []), R1. | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 31 | {ok,ok} | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 32 | 3> {C2, R2} = thrift_client:call(C1, testVoid, [asdf]), R2. | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 33 | {error,{bad_args,testVoid,[asdf]}} | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 34 | 4> {C3, R3} = thrift_client:call(C2, testI32, [123]), R3. | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 35 | {ok,123} | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 36 | 5> {C4, R4} = thrift_client:call(C3, testOneway, [1]), R4. | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 37 | {ok,ok} | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 38 | 6> {C5, R5} = thrift_client:call(C4, testXception, ["foo"]), R5. | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 39 | {error,{no_function,testXception}} | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 40 | 7> {C6, R6} = thrift_client:call(C5, testException, ["foo"]), R6. | 
| David Reiss | 702019c | 2008-06-11 00:58:13 +0000 | [diff] [blame] | 41 | {ok,ok} | 
| David Reiss | 3f660a4 | 2010-08-30 22:05:29 +0000 | [diff] [blame] | 42 | 8> {C7, R7} = (catch thrift_client:call(C6, testException, ["Xception"])), R7. | 
|  | 43 | {exception,{xception,1001,<<"Xception">>}} |