source: TI01-discovery/trunk/python/ws2/DiscoveryService_services.py @ 1563

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/trunk/python/ws2/DiscoveryService_services.py@1563
Revision 1563, 2.0 KB checked in by lawrence, 14 years ago (diff)

Python test code to communicate with new discovery web service

Line 
1##################################################
2# DiscoveryService_services.py
3# generated by ZSI.generate.wsdl2python
4##################################################
5
6
7from DiscoveryService_services_types import *
8import urlparse, types
9from ZSI.TCcompound import ComplexType, Struct
10from ZSI import client
11import ZSI
12
13# Locator
14class DiscoveryServiceLocator:
15    Discovery_address = "http://sstdwmjp.neodc.rl.ac.uk:8080/axis2/services/DiscoveryService"
16    def getDiscoveryAddress(self):
17        return DiscoveryServiceLocator.Discovery_address
18    def getDiscovery(self, url=None, **kw):
19        return DiscoverySoapBindingSOAP(url or DiscoveryServiceLocator.Discovery_address, **kw)
20
21# Methods
22class DiscoverySoapBindingSOAP:
23    def __init__(self, url, **kw):
24        kw.setdefault("readerclass", None)
25        kw.setdefault("writerclass", None)
26        # no resource properties
27        self.binding = client.Binding(url=url, **kw)
28        # no ws-addressing
29
30    # op: doFullTextSearch
31    def doFullTextSearch(self, request):
32        if isinstance(request, doFullTextSearchRequest) is False:
33            raise TypeError, "%s incorrect request type" % (request.__class__)
34        kw = {}
35        # no input wsaction
36        self.binding.Send(None, None, request, soapaction="None", **kw)
37        # no output wsaction
38        response = self.binding.Receive(doFullTextSearchResponse.typecode)
39        return response
40
41    # op: doPresent
42    def doPresent(self, request):
43        if isinstance(request, doPresentRequest) is False:
44            raise TypeError, "%s incorrect request type" % (request.__class__)
45        kw = {}
46        # no input wsaction
47        self.binding.Send(None, None, request, soapaction="None", **kw)
48        # no output wsaction
49        response = self.binding.Receive(doPresentResponse.typecode)
50        return response
51
52doFullTextSearchRequest = ns0.doFullTextSearch_Dec().pyclass
53
54doFullTextSearchResponse = ns0.doFullTextSearchReturn_Dec().pyclass
55
56doPresentRequest = ns0.doPresent_Dec().pyclass
57
58doPresentResponse = ns0.doPresentReturn_Dec().pyclass
Note: See TracBrowser for help on using the repository browser.