def listMembers(url): Binding.defaultHttpsTransport = HTTPSConnection2 fp = open('soap_trace', 'w') b = Binding(url=url, tracefile=fp) reply = b.RPC(None, 'listMembers', [], encodingStyle="http://schemas.xmlsoap.org/soap/encoding/", replytype=TC.Any("listMembersResponse", nillable=True)) return reply['listMembersReturn']
def call_webservice(cookies): global loggeduser, session print "Trying to call webservice using SSO with obtained credentials." url = 'https://cloud-mi-03.mib.infn.it/secure/webservice.php' client = Binding(url=url) for (key, value) in cookies.items(): client.cookies[key] = value print client.oncall(loggeduser)['return']
def open_stream(self, stream): # stream is SRU style URL to be opened as SRW (transport, user, passwd, host, port, dirname, filename, args, anchor) = self._parse_url(stream) if not port: port = 80 database = os.path.join(dirname, filename) self.binding = Binding(host=host, port=port, url=database, nsdict=self.namespaces) return SRW.types.SearchRetrieveRequest('searchRetrieveRequest', opts=args)
def exercise_one(): print('<----------------Exercise 1 ------------->') url = 'http://127.0.0.1/webgoat/services/SoapRequest' binding = Binding(url=url) binding.SetAuth(AUTH.httpbasic, 'guest', 'guest') try: browser = CustomizedBrowser() browser.add_password(url, 'guest', 'guest') browser.open('http://127.0.0.1/webgoat/services/SoapRequest?WSDL') soup = BeautifulSoup(browser.response().read(), 'lxml') print("test") print(soup) except mechanize.HTTPError, response: pass
from Bio.SwissProt import SProt except: sys.stderr.write( "Can't import Bio.SwissProt.SProt. You need Biopython 1.55 to use this, or set USE_BIOPYTHON_SPROT_PARSER=False to use the Uniprot web service instead." ) if USE_ZSI: from ZSI.client import Binding else: import SOAPpy fh = open(sys.argv[1], 'rU') seqs = SeqIO.parse(fh, "fasta") if USE_ZSI: server = Binding(url='', host='localhost', port=8999) else: server = SOAPpy.SOAPProxy("http://localhost:8999/") #def get_lineage_code(species, kingdoms=KINGDOMS): # lineage = server.getLineage(species) # for l in lineage: # for n in l: # #print "----------------" # for x in n: # if x in kingdoms: # return kingdoms[x] # return None def uniprotParseSpecies(record):
#!/usr/bin/python # # This uses the Python ZSI SOAP Infrastructure from: http://pywebsvcs.sourceforge.net/ # import sys; from ZSI.client import Binding; #soapclient = Binding(url='/phpgacl/soap/server.php', host='hubcap.netnation.com', tracefile=sys.stdout); soapclient = Binding(url='/phpgacl/soap/server.php', host='hubcap.netnation.com'); def acl_check(aco_section_value, aco_value, aro_section_value, aro_value, axo_section_value=0, axo_value=0, root_aro_group_id=0, root_axo_group_id=0): return soapclient.acl_check(aco_section_value, aco_value, aro_section_value, aro_value, axo_section_value, axo_value, root_aro_group_id, root_axo_group_id); if ( acl_check('system','login','users','john_doe') ): print "John Doe has been granted access to login!<br>\n"; else: print "John Doe has been denied access to login!<br>\n";
import time, sys #Import the ZSI client from ZSI.client import Binding from ZSI import TC tracefile = None #Set to sys.sysout to see debugging print "Connecting to server" start = time.time() b = Binding(url='', ns='', host='localhost', port=8888, tracefile=tracefile) end = time.time() print "Time to connect to server, %f" % (end - start) print print "Sending a long string to the server" st = "This is a test string" * 1000 start = time.time() b.receiveLargeString(st) end = time.time() print "Time to send a string of %d chars, %f" % (len(st), end - start) print print "Recieving a long stirng from the server" start = time.time() res = b.sendLargeString() end = time.time() print "Time to receive a string of %d chars, %f" % (len(res), end - start) print print "Sending lots of ints to the server"