annotate WebServiceExtensionsV1.1/WebServiceToolWorkflow_REST_SOAP/generateClient1.py @ 0:049760c677de default tip

Galaxy WSExtensions added successfully
author uga-galaxy-group
date Tue, 05 Jul 2011 19:34:18 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
1 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
2 @author Chaitanya Guttula, Sumedha Ganjoo
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
3 @see LICENSE (MIT style license file).
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
4 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
5
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
6 import warnings
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
7
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
8 with warnings.catch_warnings():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
9 warnings.simplefilter("ignore")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
10 import platform
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
11
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
12 from jpype._jpackage import JPackage
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
13 from jpype import *
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
14 import os.path
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
15 import sys
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
16 import string
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
17 from edit_tool_conf1 import *
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
18 from clientGenerator.msHandler import *
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
19 from clientGenerator.creatorEngineComplex import *
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
20 from clientGenerator.wsdl2path import *
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
21 from clientGenerator.paramConverter import *
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
22
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
23 __author__=""
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
24
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
25 #generates client for a web service to be used as standalone
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
26 class ClientGenerator1(object):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
27
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
28 def __init__(self,webservice,operation,outputfile,servicetype):#,url):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
29 with warnings.catch_warnings():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
30 warnings.simplefilter("ignore")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
31 self.webservice = webservice
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
32 self.operation = operation
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
33 self.inputs = outputfile
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
34 self.outputfile = outputfile
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
35 #self.url = url
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
36
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
37 self.servicetype = servicetype
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
38 self.galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
39 self.clientfile = ''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
40 if self.servicetype == 'SOAP':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
41 wLoad=wsdlLoader()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
42 sys.path.append(self.galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clientGenerator')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
43 os.chdir(self.galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clientGenerator')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
44
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
45 a = str(self.webservice).split('/')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
46 wsdlnamelist = a[len(a)-1].split(".")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
47 if len(wsdlnamelist)==1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
48 wsdlnamelist=a[len(a)-1].split('?')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
49 print wsdlnamelist
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
50
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
51 foldername=wsdlnamelist[0]
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
52
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
53 path =self.galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clientGenerator/'+foldername
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
54
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
55 #creates the client stubs
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
56 self.clientfile = wLoad.wsdlUrl2path(str(self.webservice),foldername)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
57
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
58 print 'Client file : ',self.clientfile
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
59 self.paramelement = None
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
60
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
61
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
62
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
63 ''' Replaces space (' ') with '**' in the given string '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
64 def formatString(self,string):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
65 l = string.split(' ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
66 return '**'.join(l)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
67
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
68 def isRequired(self,param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
69 #j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
70 #for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
71 cc = ClientCreator()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
72 self.msinstance = cc.opname2inputClassOb(self.operation,self.clientfile)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
73 test = MessageHandler()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
74 required = False
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
75 if (param.find('|$|')>-1):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
76 plist = param.split('|')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
77 #root = test.getParameter(self.msinstance(),plist[0])
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
78 k = 0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
79 iparam = ''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
80 for p in plist:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
81 if(k<len(plist)-3):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
82 if(k==0):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
83 iparam = iparam+(p)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
84 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
85 iparam = iparam+'|'+p
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
86 k=k+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
87 paramelement = test.getParameter(self.msinstance(),iparam)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
88 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
89 paramelement = test.getParameter(self.msinstance(),param)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
90 self.paramelement = paramelement
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
91 if (param.find('|')>-1):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
92 plist = param.split('|')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
93 root = test.getParameter(self.msinstance(),plist[0])
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
94 if not getattr(root,'nillable') and not getattr(paramelement,'nillable'):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
95 required = True
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
96 return True
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
97 elif getattr(root,'nillable') or (not getattr(root,'nillable') and getattr(paramelement,'nillable')):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
98 required = False
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
99 return False
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
100 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
101 if not getattr(paramelement,'nillable'):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
102 required = True
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
103 return True
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
104 elif getattr(paramelement,'nillable'):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
105 required = False
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
106 return False
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
107 return required
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
108
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
109
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
110 #replace '**' with ' '
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
111 def formatString(self,string):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
112 l = string.split(' ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
113 return '**'.join(l)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
114
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
115 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
116 Checks if the tool(operation) is already addded to Galaxy. It opens the tool_conf.xml file and loops through the "Web Service Workflow Tools" sections
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
117 Then opens each and every tool (xml file) and looks for the description tag for the "Web Service" and "Client for Method" values and then checks
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
118 if it same as the opearation and web service. As the code is dependent on description of the toool xml fie, any change in the description
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
119 of the tool xml file can impact this function.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
120 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
121 def isToolPresent(self):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
122
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
123 f = open(self.galaxyhome+'/tool_conf.xml','r')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
124 line = f.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
125 linestripped = line.lstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
126 linestripped = linestripped.rstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
127
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
128 while linestripped != '<section name="Select Web Service Tool" id="WebServices">':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
129 line = f.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
130 linestripped = line.lstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
131 linestripped = linestripped.rstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
132
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
133 line = f.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
134 linestripped = line.lstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
135 linestripped = linestripped.rstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
136
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
137 while linestripped != '</section>':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
138 if linestripped.find('<') >-1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
139 toolparts = linestripped.split('"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
140 print '\ntoolparts are : ',toolparts
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
141 f1 = open(self.galaxyhome+'/tools/'+toolparts[-2],'r')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
142 line1 = f1.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
143 while not line1.find('<description>') >-1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
144 line1 = f1.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
145
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
146 linestripped1 = line1.lstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
147 linestripped1 = linestripped1.rstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
148 descriptionparts=linestripped1.split(' ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
149 print '\nOperation : ',descriptionparts
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
150 service = ''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
151 if(self.servicetype == 'SOAP'):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
152 service = self.clientfile
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
153 elif self.servicetype == 'REST':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
154 service = self.webservice
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
155 if(descriptionparts[5]==self.operation and descriptionparts[10] == service):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
156 f.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
157 f1.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
158 return True
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
159 f1.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
160 line = f.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
161 linestripped = line.lstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
162 linestripped = linestripped.rstrip()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
163
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
164 f.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
165 return False
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
166
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
167
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
168 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
169 Creates a client file2 (xml file) for the given opertion in the SOAP web service
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
170 This operation is invokes standalone and is cannot be used in workflows
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
171 Then invokes another operation which adds this client file (tool) to the toolconfig.xml
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
172 under 'Web Service Tools'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
173
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
174 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
175
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
176 def wsdlClient(self):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
177 with warnings.catch_warnings():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
178 warnings.simplefilter("ignore")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
179 wLoad=wsdlLoader()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
180 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
181 sys.path.append(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clientGenerator')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
182 os.chdir(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clientGenerator')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
183
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
184 a= str(self.webservice).split('/')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
185 wsdlnamelist = a[len(a)-1].split(".")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
186 if len(wsdlnamelist)==1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
187 wsdlnamelist=a[len(a)-1].split('?')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
188 print wsdlnamelist
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
189
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
190 foldername=wsdlnamelist[0]
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
191
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
192 path =galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clientGenerator/'+foldername
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
193
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
194 #creates the client stubs
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
195 clientfile=wLoad.wsdlUrl2path(str(self.webservice),foldername)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
196
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
197 webservice = clientfile#sys.argv[4]
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
198 #operation = sys.argv[3]
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
199 outputfile=open(self.outputfile,'w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
200 test = ClientCreator()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
201 inputs= test.opname2inputs(self.operation,webservice)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
202 inputl = nested2flatDict(inputs)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
203 inputlist = inputl.keys()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
204 #noOfInputs=inputlist.count()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
205 count =0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
206 if (len(inputs)==0):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
207 inputs={' ':' '}
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
208 #inputlist=inputs.keys()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
209 for i in inputlist:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
210 if count==0:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
211 outputfile.write(i+'\t'+webservice+'\t'+self.operation+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
212 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
213 outputfile.write(i+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
214 count=count+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
215
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
216
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
217 cc = ClientCreator()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
218 self.msinstance = cc.opname2inputClassOb(self.operation,webservice)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
219
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
220 ##generate client's xml
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
221 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
222
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
223 #./clients/ClientCount.xml keeps the count of the clients/tools currently registered in Galaxy for Web service invocation.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
224 #read the count and increment it.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
225
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
226 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/ClientCount.xml','r')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
227 clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
228 clientCountStr = clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
229 clientCount=string.atoi(clientCountStr)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
230 clientCount=clientCount+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
231 clientCountFile.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
232
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
233 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/ClientCount.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
234 clientCountFile.write('<count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
235 clientCountFile.write(str(clientCount)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
236 clientCountFile.write('</count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
237 clientCountFile.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
238
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
239 clientName = 'WebServiceclient_'+ str(clientCount)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
240
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
241 clientXml=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/'+clientName+'.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
242 clientXml.seek(0,0)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
243
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
244 clientXml.write('<tool id="' + clientName+'" name="'+foldername+'.' + self.operation +'">\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
245 clientXml.write(' <description> Client for operation : '+self.operation+' , Web service : '+webservice+' </description>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
246
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
247 #Only Required parameters
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
248 clientXml.write(' <command interpreter="python">\n #if $cond_source.optional_param_source=="no" #client_1.py'+' $output $servicetype ' +webservice+' '+self.operation)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
249
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
250 #clientXml.write(' <command interpreter="python">\n client_1.py \n' +' $output \n ' +self.webservice+' \n '+self.operation+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
251 ##write such that the parameters passed to client1.py(change name to clientName.py) are dependent on a for loop
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
252 test = MessageHandler()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
253 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
254 for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
255 if self.isRequired(param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
256 clientXml.write(' "'+param+'"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
257 clientXml.write(' $param'+str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
258 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
259
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
260
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
261 #Both Required and optional paramters
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
262 clientXml.write(' #else #client_1.py'+' $output $servicetype ' +webservice+' '+self.operation+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
263
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
264 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
265 Required parameters - If the parameter is complex type (tree structure) then the the parameter is required
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
266 only if both the root node and the leaf node are required (i.e. both root and leaf have attribute nillable as false)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
267 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
268
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
269 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
270 for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
271 if self.isRequired(param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
272 clientXml.write(' "'+param+'"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
273 clientXml.write(' $param'+str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
274 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
275
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
276
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
277 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
278 Optional parameters - If the parameter is complex type (tree structure) then the the paramter is optional
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
279 if its root element is optional (i.e. root has attribute nillable as true) even if the leaf node (element)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
280 is required (i.e. leaf element has attribute nillable as false)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
281 '''
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
282 for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
283 if not self.isRequired(param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
284 clientXml.write(' "'+param+'"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
285 clientXml.write(' $param'+str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
286 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
287
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
288
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
289 #params for array type
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
290 # for param in self.inputs:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
291 # paramelement = test.getParameter(self.msinstance(),param)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
292 # if getattr(paramelement,'nillable')==True:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
293 # if string.find(param,"|0|")>-1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
294 # ele = string(param,"|0|")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
295 # for param in self.inputs:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
296
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
297
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
298 # clientXml.write(' "'+param+'"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
299 # clientXml.write(' $cond_source.param' + str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
300 # j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
301
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
302 clientXml.write(' #end if \n</command>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
303
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
304
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
305 # for param in self.inputs:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
306 # paramelement = test.getParameter(self.msinstance(),param)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
307 # if getattr(paramelement,'nillable')==False or getattr(paramelement,'minOccurs')==1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
308 # clientXml.write(' "'+param+'"\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
309 # clientXml.write(' $param'+str(j)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
310 # j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
311
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
312
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
313 #clientXml.write('</command>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
314
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
315 #start writing inputs
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
316 ##write inputs depending on required or not. if not required den dont display
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
317 ##if required- den check default value, and if options exist.Depending on that
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
318 ##decide the type of parameter and options
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
319 ##The input servicetype tells what type of webservice it is wether SOAP or REST - Useful during invocation of the web servcie
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
320 clientXml.write(' <inputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
321 clientXml.write(' <param name="servicetype" type="hidden" value="SOAP" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
322
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
323
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
324 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
325 for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
326 if self.isRequired(param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
327 pName = getattr(self.paramelement,'pname')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
328 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
329 clientXml.write('type="text" label="Enter '+pName+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
330 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
331
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
332 clientXml.write('\n <conditional name="cond_source"> \n <param name="optional_param_source" type="select" label="Show Optional Parameters">\n <option value="no" selected="true">no</option> \n <option value="yes">yes</option> \n </param>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
333 clientXml.write('<when value="no"> \n </when>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
334 clientXml.write('<when value="yes"> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
335
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
336 for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
337 if not self.isRequired(param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
338 pName = getattr(self.paramelement,'pname')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
339 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
340 clientXml.write('type="text" label="Enter '+pName+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
341 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
342
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
343
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
344 clientXml.write('</when>\n</conditional>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
345
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
346 # j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
347 # for param in self.inputs:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
348 # paramelement = test.getParameter(self.msinstance(),param)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
349 # if not getattr(paramelement,'nillable'):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
350 # pName = getattr(paramelement,'pname')#param.getName()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
351 # clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
352 # clientXml.write('type="text" label="'+pName+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
353 # j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
354
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
355 clientXml.write('</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
356
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
357 clientXml.write(' <help>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
358 paramtype = None
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
359 for param in inputl:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
360 if self.isRequired(param):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
361 if isinstance(self.paramelement,ZSI.TC.String):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
362 paramtype = 'String'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
363 elif isinstance(self.paramelement,ZSI.TCnumbers.FPfloat):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
364 paramtype = 'Floating point'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
365 elif isinstance(self.paramelement,ZSI.TC.Boolean):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
366 paramtype = 'Boolean'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
367 elif isinstance(self.paramelement,ZSI.TCnumbers.Iint):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
368 paramtype = 'Integer'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
369 clientXml.write('\n.. class:: infomark\n\n**TIP:** About '+ getattr(self.paramelement,'pname') +': type is ' + paramtype + '\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
370
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
371
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
372
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
373
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
374 clientXml.write(' </help>\n</tool>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
375
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
376 # clientXml.write(' <help>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
377
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
378 # j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
379 # for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
380 # clientXml.write('\n.. class:: infomark\n\n**TIP:** '+ param +' type is ' + paramTypes[j] +'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
381
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
382 # clientXml.write(' </help>\n</tool>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
383 # clientXml.write('</tool>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
384 clientXml.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
385 editor = editToolConfig1()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
386 editor.addTool(clientName)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
387
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
388 ##later add help feature
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
389
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
390
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
391 def wadlClient(self):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
392 ##parse wadl
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
393 pkg=JPackage('lsdis')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
394 urlToPass=java.net.URL(self.webservice)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
395 wadlUrl = self.webservice
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
396
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
397 webserviceId = ''#self.operation
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
398 resUrl = self.operation
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
399
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
400 urls = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
401 methods = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
402 params = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
403 docs = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
404
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
405 WADLParserDriver=pkg.WADLParserDriver
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
406 wPD=WADLParserDriver()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
407 wPD.parse(urlToPass)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
408 urls = wPD.getUrl()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
409 methods = wPD.getCompleteMethodList()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
410
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
411 #write into the output file information about the method and Web service to be invoked.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
412 f=open(self.outputfile,'w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
413 f.write(self.webservice)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
414 f.write('\n'+ resUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
415
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
416 a= str(self.webservice).split('/')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
417 wadlnamelist = a[len(a)-1].split(".")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
418 if len(wadlnamelist)==1:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
419 wadlnamelist=a[len(a)-1].split('?')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
420 print wadlnamelist
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
421
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
422 wadlname=wadlnamelist[0]
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
423
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
424
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
425 #get parameters for the selected method of the Web service
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
426 i=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
427 for method in methods:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
428 x = str(method.getId())
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
429 y = str(urls.get(i))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
430 webserviceId = x
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
431 #if x==webserviceId:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
432 if y == resUrl :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
433 params = method.getRequest().getParams()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
434 break
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
435 i=i+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
436
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
437 f.write('\n'+webserviceId)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
438 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
439
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
440 methodname = resUrl.split('/')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
441
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
442 #./clients/ClientCount.xml keeps the count of the clients/tools currently registered in Galaxy for Web service invocation.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
443 #read the count and increment it.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
444 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/ClientCount.xml','r')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
445 clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
446 clientCountStr = clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
447 clientCount=string.atoi(clientCountStr)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
448 clientCount=clientCount+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
449 clientCountFile.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
450
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
451 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/ClientCount.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
452
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
453 clientCountFile.write('<count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
454 clientCountFile.write(str(clientCount)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
455 clientCountFile.write('</count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
456
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
457 #include the count in the tool's name and id to uniquely identify it.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
458 clientName = 'WebServiceclient_'+ str(clientCount)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
459
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
460 #create a new xml file under ./clients/
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
461 clientXml=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/'+clientName+'.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
462 clientXml.seek(0,0)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
463
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
464 #write the tool id, name and description
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
465 clientXml.write('<tool id="' + clientName+'1" name="'+wadlname+'.' + methodname[-1] +' ">\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
466 clientXml.write(' <description> Client for method : '+self.operation+' , Web service : '+self.webservice+' </description>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
467
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
468 #the one-time invocation tool/client for a REST Web service invokes ./clients/client_1.py to invoke the Web service
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
469 #write the command tag to specify the arguments passed to this client_1.py
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
470 clientXml.write(' <command interpreter="python">\n #if $cond_source.optional_param_source=="no" #client_1.py'+' $output $servicetype ' +resUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
471
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
472 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
473
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
474 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
475 if param.isRequired():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
476 clientXml.write(' '+self.formatString(param.getName()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
477 clientXml.write(' $param' + str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
478 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
479 clientXml.write(' #else #client_1.py'+' $output $servicetype ' +resUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
480 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
481 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
482 if param.isRequired():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
483 clientXml.write(' '+self.formatString(param.getName()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
484 clientXml.write(' $param' + str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
485 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
486
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
487 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
488 if not param.isRequired():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
489 clientXml.write(' '+self.formatString(param.getName()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
490 clientXml.write(' $cond_source.param' + str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
491 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
492 clientXml.write(' #end if \n</command>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
493
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
494 #start writing inputs
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
495 ##write inputs depending on required or not. if not required den dont display
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
496 ##if required- den check default value, and if options exist.Depending on that
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
497 ##decide the type of parameter and options
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
498 ##The input servicetype tells what type of webservice it is wether SOAP or REST - Useful during invocation of the web servcie
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
499 clientXml.write(' <inputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
500 clientXml.write(' <param name="servicetype" type="hidden" value="REST" />')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
501
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
502 #create a param for each required parameter described in the WADL. Check if defaults and options are specified in the WADL
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
503 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
504 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
505 if param.isRequired():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
506 pName = param.getName()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
507 for doc in param.getDocs():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
508 if doc.getTitle()=="prompt" or doc.getTitle()=="Prompt" or doc.getTitle()=="PROMPT":
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
509 pName = doc.getInnerText()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
510 if param.getOptions().size()==0:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
511 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
512 if not param.getDefault1() == None:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
513 clientXml.write('value="'+param.getDefault1()+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
514 clientXml.write('type="text" label="Enter '+pName+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
515 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
516 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
517 clientXml.write('<param name="param'+str(j)+'" type="select" label="Select '+pName+'" help="see tip below">\n' )
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
518 for option in param.getOptions():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
519 clientXml.write(' <option value="'+self.formatString(option.getName())+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
520 if option.getName() == param.getDefault1():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
521 clientXml.write('selected="true"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
522 clientXml.write('>'+option.getName()+'</option>\n ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
523 clientXml.write(' </param> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
524 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
525
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
526 #create a conditional param for each optional parameter described in the WADL.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
527 clientXml.write('\n <conditional name="cond_source"> \n <param name="optional_param_source" type="select" label="Show Optional Parameters">\n <option value="no" selected="true">no</option> \n <option value="yes">yes</option> \n </param>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
528 clientXml.write('<when value="no"> \n </when>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
529 clientXml.write('<when value="yes"> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
530 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
531 if not param.isRequired():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
532 pName = param.getName()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
533 for doc in param.getDocs():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
534 if doc.getTitle()=="prompt" or doc.getTitle()=="Prompt" or doc.getTitle()=="PROMPT":
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
535 pName = doc.getInnerText()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
536 if param.getOptions().size()==0:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
537 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
538 if not param.getDefault1() == None:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
539 clientXml.write('value="'+param.getDefault1()+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
540 clientXml.write('type="text" label="Enter '+pName+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
541 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
542 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
543 clientXml.write('<param name="param'+str(j)+'" type="select" label="Select '+pName+'" help="see tip below">\n' )
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
544 for option in param.getOptions():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
545 clientXml.write(' <option value="'+self.formatString(option.getName())+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
546 if option.getName() == param.getDefault1():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
547 clientXml.write('selected="true"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
548 clientXml.write('>'+option.getName()+'</option>\n ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
549 clientXml.write(' </param> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
550 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
551
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
552
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
553 clientXml.write('</when>\n</conditional>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
554 clientXml.write('</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
555
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
556 #write information about each parameter in the help section
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
557 clientXml.write(' <help>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
558
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
559 clientXml.write('Replace white space with ** in all parameter values\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
560
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
561 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
562 if param.isRequired():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
563 pName = param.getName()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
564 for doc in param.getDocs():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
565 if doc.getTitle()=="prompt" or doc.getTitle()=="Prompt" or doc.getTitle()=="PROMPT":
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
566 pName = doc.getInnerText()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
567 clientXml.write('\n.. class:: infomark\n\n**TIP:** '+ pName +' type is ' + param.getType()+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
568
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
569 clientXml.write(' </help>\n</tool>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
570
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
571
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
572 #adds the newly created tool to tool_conf.xml in Galaxy under the 'Web Service Tools' section.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
573 editor = editToolConfig1()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
574 editor.addTool(clientName)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
575
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
576 ##later add help feature
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
577
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
578
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
579 def sawadlClient(self):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
580 ##parse sawadl
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
581 javahome = os.environ.get('JAVA_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
582 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
583 classpath= galaxyhome + '/tools/WebServiceToolWorkflow_REST_SOAP/lib/SAWADLParser/bin'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
584 jarpath = galaxyhome + '/tools/WebServiceToolWorkflow_REST_SOAP/lib/'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
585 machine = platform.machine()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
586
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
587 #if machine == 'x86_64' :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
588 # print 'a'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
589 # startJVM("%s/jre/lib/amd64/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
590 #elif machine == 'i686' :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
591 # print 'b'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
592 # startJVM("%s/jre/lib/i386/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
593 #elif machine == 'sun4u' :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
594 # startJVM("%s/jre/lib/sparc/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
595 #else :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
596 # print 'c'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
597 # System.exit("Could not identify machine, please specify path to libjvm.so")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
598
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
599
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
600 pkg=JPackage('edu.uga.cs.lsdis.meteors.wadls')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
601 pkgModel =JPackage('org.semanticweb.owlapi.model')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
602 pkgApiBinding =JPackage('org.semanticweb.owlapi.apibinding')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
603 pkgVocab = JPackage('org.semanticweb.owlapi.vocab')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
604
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
605 DOCUMENT_IRI = "http://cs.uga.edu/~ganjoo/galaxy/EDAM.owl"
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
606
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
607 sawadlUrl = self.webservice
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
608
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
609 webserviceId = ''#self.methodName
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
610 resUrl = self.operation
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
611
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
612 urls = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
613 methods = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
614 params = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
615 annotationSet = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
616
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
617 SAWADLParserDriver=pkg.SAWADLParserDriver
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
618 sawPD=SAWADLParserDriver()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
619 sawPD.parse(sawadlUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
620 urls = sawPD.getUrl()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
621 methods = sawPD.getCompleteMethodList()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
622
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
623 IRI = pkgModel.IRI
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
624 OWLRDFVocabulary = pkgVocab.OWLRDFVocabulary
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
625 OWLManager = pkgApiBinding.OWLManager
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
626 OWLLiteral = pkgModel.OWLLiteral
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
627 owlOntManager = OWLManager.createOWLOntologyManager()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
628 ontology = owlOntManager.loadOntologyFromOntologyDocument(IRI.create(DOCUMENT_IRI))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
629 dataFactory = owlOntManager.getOWLDataFactory()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
630 propertyComment = dataFactory.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI())
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
631
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
632 f=open(self.outputfile,'w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
633 f.write(sawadlUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
634 f.write(resUrl+'\t')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
635
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
636
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
637 i=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
638 for method in methods:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
639 x = str(method.getName())
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
640 y = str(urls.get(i))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
641 #if x == webserviceId :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
642 webserviceId = x
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
643 if y == resUrl :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
644 params = method.getRequest().getParamList()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
645 break
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
646 i=i+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
647
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
648 f.write(webserviceId)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
649
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
650
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
651 ##generate client's xml
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
652 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
653
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
654 #./clients/ClientCount.xml keeps the count of the clients/tools currently registered in Galaxy for Web service invocation.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
655 #read the count and increment it.
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
656
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
657 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/ClientCount.xml','r')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
658 clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
659 clientCountStr = clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
660 clientCount=string.atoi(clientCountStr)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
661 clientCount=clientCount+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
662 clientCountFile.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
663
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
664 clientCountFile=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/ClientCount.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
665 clientCountFile.write('<count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
666 clientCountFile.write(str(clientCount)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
667 clientCountFile.write('</count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
668
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
669 clientName = 'WebServiceclient_'+ str(clientCount)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
670
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
671 clientXml=open(galaxyhome+'/tools/WebServiceToolWorkflow_REST_SOAP/clients/'+clientName+'.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
672 clientXml.seek(0,0)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
673
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
674 clientXml.write('<tool id="' + clientName+'1" name="' + webserviceId +'">\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
675 clientXml.write(' <description> Client for method: '+webserviceId+' , Web service: '+self.webservice+' </description>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
676
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
677
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
678 clientXml.write(' <command interpreter="python">\n #if $cond_source.optional_param_source=="no" #client_1.py'+' $output $servicetype ' +resUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
679 ##write such that the parameters passed to client1.py(change name to clientName.py) are dependent on a for loop
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
680
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
681
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
682 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
683 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
684 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
685 clientXml.write(' '+self.formatString(param.getName())+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
686 clientXml.write(' $param' + str(j)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
687 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
688
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
689 clientXml.write(' #else #client_1.py'+' $output $servicetype ' +resUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
690 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
691 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
692 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
693 clientXml.write(' '+self.formatString(param.getName()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
694 clientXml.write(' $param' + str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
695 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
696
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
697 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
698 if not param.getRequired()=='true' and not param.getRequired()=='True' and not param.getRequired()=='TRUE':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
699 clientXml.write(' '+self.formatString(param.getName()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
700 clientXml.write(' $cond_source.param' + str(j))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
701 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
702
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
703 clientXml.write('#end if \n </command>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
704
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
705 #start writing inputs
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
706 ##write inputs depending on required or not. if not required den dont display
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
707 ##if required- den check default value, and if options exist.Depending on that
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
708 ##decide the type of parameter and options
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
709 ##The input param servicetype tells what type of webservice it is wether SOAP or REST - Useful during invocation of the web servcie
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
710 clientXml.write(' <inputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
711 cleintXml.write(' <param name="servicetype" type="hidden" value="REST"/>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
712
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
713 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
714 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
715 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
716 f.write('\n '+ param.getName() + ' options: '+str(param.getOptionvalue().size()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
717 if param.getOptionvalue().size()==0:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
718 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
719 if not param.getDefault1() == None:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
720 clientXml.write('value="'+param.getDefault1()+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
721 clientXml.write('type="text" label="Enter '+param.getName()+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
722 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
723 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
724 clientXml.write('<param name="param'+str(j)+'" type="select" label="Select '+param.getName()+'" help="see tip below">\n' )
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
725 for option in param.getOptionvalue():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
726 clientXml.write(' <option value="'+self.formatString(option)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
727 if option == param.getDefault1():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
728 clientXml.write('selected="true"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
729 clientXml.write('>'+option+'</option>\n ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
730 clientXml.write(' </param> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
731 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
732
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
733
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
734 clientXml.write('\n <conditional name="cond_source"> \n <param name="optional_param_source" type="select" label="Display Optional Parameters">\n <option value="no" selected="true">no</option> \n <option value="yes">yes</option> \n </param>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
735 clientXml.write('<when value="no"> \n </when>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
736 clientXml.write('<when value="yes"> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
737
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
738 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
739 if not param.getRequired()=='true' and not param.getRequired()=='True' and not param.getRequired()=='TRUE':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
740 f.write('\n '+ param.getName() + ' options: '+str(param.getOptionvalue().size()))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
741 if param.getOptionvalue().size()==0:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
742 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
743 if not param.getDefault1() == None:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
744 clientXml.write('value="'+param.getDefault1()+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
745 clientXml.write('type="text" label="Enter '+param.getName()+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
746 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
747 else:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
748 clientXml.write('<param name="param'+str(j)+'" type="select" label="Select '+param.getName()+'" help="see tip below">\n' )
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
749 for option in param.getOptionvalue():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
750 clientXml.write(' <option value="'+self.formatString(option)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
751 if option == param.getDefault1():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
752 clientXml.write('selected="true"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
753 clientXml.write('>'+option+'</option>\n ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
754 clientXml.write(' </param> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
755 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
756
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
757 clientXml.write('</when>\n</conditional>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
758
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
759 clientXml.write('</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
760
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
761 clientXml.write(' <help>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
762 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
763 if param.getRequired()=='true' or param.getRequired()=='True' or param.getRequired()=='TRUE':
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
764 clientXml.write('\n.. class:: infomark\n\n**TIP:** About '+ param.getName() +': type is ' + param.getType())
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
765
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
766 modelRef = sawPD.getCompleteModelReference(param)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
767 if not modelRef is None:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
768 paramClass = dataFactory.getOWLClass(IRI.create(modelRef));
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
769 annotationSet = paramClass.getAnnotations(ontology,propertyComment)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
770 for annotation in annotationSet:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
771 if isinstance(annotation.getValue(),OWLLiteral):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
772 val = annotation.getValue()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
773 if val.isOWLStringLiteral() and not val.isOWLTypedLiteral():
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
774 print 'val.getLiteral()=' + val.getLiteral()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
775 clientXml.write(', description from ontology is "' + val.getLiteral()+'"')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
776 break
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
777 clientXml.write('\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
778 clientXml.write(' </help>\n</tool>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
779 editor = editToolConfig1()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
780 editor.addTool(clientName)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
781
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
782 ##later add help feature
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
783
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
784 def wsdlRESTClient(self):
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
785 ##parse wadl
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
786 javahome = os.environ.get('JAVA_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
787 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
788 classpath= galaxyhome + '/tools/WebServiceToolWorkflow_REST_SOAP/WodenWSDLParser/bin'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
789 jarpath = galaxyhome + '/tools/WebServiceToolWorkflow_REST_SOAP/WodenWSDLParser/lib/'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
790 machine = platform.machine()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
791
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
792 if machine == 'x86_64' :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
793 print 'a'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
794 startJVM("%s/jre/lib/amd64/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
795 elif machine == 'i686' :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
796 print 'b'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
797 startJVM("%s/jre/lib/i386/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
798 elif machine == 'sun4u' :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
799 startJVM("%s/jre/lib/sparc/server/libjvm.so" % javahome,"-ea", "-Djava.class.path=%s" % classpath,"-Djava.ext.dirs=%s" % jarpath)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
800 else :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
801 print 'c'
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
802 System.exit("Could not identify machine, please specify path to libjvm.so")
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
803
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
804
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
805 pkg=JPackage('lsdis')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
806 wsdlUrl = self.webserviceId
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
807
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
808 webserviceId = ''#self.methodName
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
809 resUrl = self.resourceName
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
810
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
811 urls = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
812 methods = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
813 params = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
814 paramTypes = []
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
815
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
816 WSDLParserDriver =pkg.WSDLParserDriver
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
817 wPD=WSDLParserDriver()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
818 wPD.parse(wsdlUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
819 methods = wPD.getCompleteMethodList()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
820 urls = wPD.getUrl()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
821
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
822 f=open(self.Ofile,'w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
823 f.write(wsdlUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
824 f.write('\n'+ resUrl)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
825 f.write('\n'+webserviceId)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
826
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
827
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
828 i=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
829 for method in methods:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
830 x = str(method.getName().getLocalPart())
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
831 y = str(url.get(i))
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
832 webserviceId = x
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
833 if y == resUrl :
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
834 wPD.getParameters(x)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
835 f.write('method matched')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
836 paramTypes = wPD.getParamTypeList()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
837 params = wPD.getParamList()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
838 break
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
839 i=i+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
840
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
841
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
842
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
843
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
844 ##generate client's xml
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
845 galaxyhome=os.environ.get('GALAXY_HOME')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
846
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
847 clientCountFile=open(galaxyhome+'/tools/WebServiceTool/clients/ClientCount.xml','r')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
848 clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
849 clientCountStr = clientCountFile.readline()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
850 clientCount=string.atoi(clientCountStr)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
851 clientCount=clientCount+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
852 clientCountFile.close()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
853
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
854 clientCountFile=open(galaxyhome+'/tools/WebServiceTool/clients/ClientCount.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
855 clientCountFile.write('<count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
856 clientCountFile.write(str(clientCount)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
857 clientCountFile.write('</count> \n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
858
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
859
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
860
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
861
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
862 clientName = 'WebServiceclient_'+ str(clientCount)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
863
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
864 clientXml=open(galaxyhome+'/tools/WebServiceTool/clients/'+clientName+'.xml','w')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
865 clientXml.seek(0,0)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
866
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
867 clientXml.write('<tool id="' + clientName+'" name="' + webserviceId +'">\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
868 clientXml.write(' <description> Client for method: '+webserviceId+' , Web service: '+self.webservice+' </description>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
869
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
870
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
871 clientXml.write(' <command interpreter="python">\n client_1.py \n'+' $output \n $servicetype\n ' +resUrl+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
872 ##write such that the parameters passed to client1.py(change name to clientName.py) are dependent on a for loop
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
873
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
874 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
875 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
876 clientXml.write(' '+self.formatString(param)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
877 clientXml.write(' $param' + str(j)+'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
878 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
879 clientXml.write('</command>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
880
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
881 ##write inputs depending on required or not. if not required den dont display
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
882 ##if required- den check default value, and if options exist.Depending on that
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
883 ##decide the type of parameter and options
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
884 clientXml.write(' <inputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
885 cleintXml.write(' <param name="servicetype" type="hidden" value="REST"/>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
886
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
887 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
888 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
889 clientXml.write('<param format="text" size = "150" name = "param'+str(j)+'" ')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
890 clientXml.write('type="text" label="'+param+'" help="see tip below" />\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
891 j=j+1
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
892
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
893
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
894
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
895 clientXml.write('</inputs>\n <outputs>\n <data format="tabular" name="output" />\n </outputs>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
896
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
897 clientXml.write(' <help>\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
898
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
899 clientXml.write('** Replace white with ** in all parameter values **\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
900
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
901 j=0
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
902 for param in params:
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
903 clientXml.write('\n.. class:: infomark\n\n**TIP:** '+ param +' type is ' + paramTypes[j] +'\n')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
904
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
905 clientXml.write(' </help>\n</tool>')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
906 editor = editToolConfig()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
907 editor.addTool(clientName)
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
908
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
909 ##later add help feature
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
910
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
911
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
912 # Addedfor testing purpose
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
913
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
914 if __name__ == "__main__":
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
915
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
916 test = ClientGenerator1('http://www.cs.uga.edu/~guttula/wublast.wsdl','run',None,'SOAP')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
917 present = test.isToolPresent()
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
918 required = test.isRequired('_parameters|_sequence')
049760c677de Galaxy WSExtensions added successfully
uga-galaxy-group
parents:
diff changeset
919 print 'required : ',required