Mercurial > repos > ktnyt > gembassy
comparison GEMBASSY-1.0.3/src/gentrez.c @ 0:8300eb051bea draft
Initial upload
author | ktnyt |
---|---|
date | Fri, 26 Jun 2015 05:19:29 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8300eb051bea |
---|---|
1 /****************************************************************************** | |
2 ** @source gentrez | |
3 ** | |
4 ** Search NCBI Entrez in G-language Shell | |
5 ** | |
6 ** @author Copyright (C) 2012 Hidetoshi Itaya | |
7 ** @version 1.0.3 | |
8 ** @modified 2012/1/20 Hidetoshi Itaya Created! | |
9 ** @modified 2013/6/16 Revision 1 | |
10 ** @modified 2015/2/7 Refactor | |
11 ** @@ | |
12 ** | |
13 ** This program is free software; you can redistribute it and/or | |
14 ** modify it under the terms of the GNU General Public License | |
15 ** as published by the Free Software Foundation; either version 2 | |
16 ** of the License, or (at your option) any later version. | |
17 ** | |
18 ** This program is distributed in the hope that it will be useful, | |
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ** GNU General Public License for more details. | |
22 ** | |
23 ** You should have received a copy of the GNU General Public License | |
24 ** along with this program; if not, write to the Free Software | |
25 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
26 ******************************************************************************/ | |
27 | |
28 | |
29 #include "emboss.h" | |
30 #include "soapH.h" | |
31 #include "GLANGSoapBinding.nsmap" | |
32 #include "soapClient.c" | |
33 #include "soapC.c" | |
34 #include "../gsoap/stdsoap2.c" | |
35 #include "glibs.h" | |
36 | |
37 | |
38 | |
39 | |
40 /* @prog gentrez ************************************************************** | |
41 ** | |
42 ** Search NCBI Entrez in G-language Shell | |
43 ** | |
44 ******************************************************************************/ | |
45 | |
46 int main(int argc, char *argv[]) | |
47 { | |
48 embInitPV("gentrez", argc, argv, "GEMBASSY", "1.0.3"); | |
49 | |
50 struct soap soap; | |
51 | |
52 AjPStr database = NULL; | |
53 AjPStr query = NULL; | |
54 | |
55 char *in0; | |
56 char *in1; | |
57 char *result; | |
58 | |
59 AjPFile outf = NULL; | |
60 | |
61 database = ajAcdGetString("database"); | |
62 query = ajAcdGetString("query"); | |
63 outf = ajAcdGetOutfile("outfile"); | |
64 | |
65 in0 = ajCharNewS(database); | |
66 in1 = ajCharNewS(query); | |
67 | |
68 soap_init(&soap); | |
69 | |
70 if(soap_call_ns1__entrez( | |
71 &soap, | |
72 NULL, | |
73 NULL, | |
74 in0, | |
75 in1, | |
76 &result | |
77 ) == SOAP_OK) | |
78 { | |
79 if(result) | |
80 { | |
81 ajFmtPrintF(outf, "%s", result); | |
82 } | |
83 else | |
84 { | |
85 ajFmtPrintF(outf, "No results found.\n"); | |
86 } | |
87 } | |
88 else | |
89 { | |
90 soap_print_fault(&soap, stderr); | |
91 } | |
92 | |
93 soap_destroy(&soap); | |
94 soap_end(&soap); | |
95 soap_done(&soap); | |
96 | |
97 ajFileClose(&outf); | |
98 | |
99 AJFREE(in0); | |
100 AJFREE(in1); | |
101 | |
102 ajStrDel(&database); | |
103 ajStrDel(&query); | |
104 | |
105 embExit(); | |
106 | |
107 return 0; | |
108 } |