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

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

Test code that works with the latest Matt discovery wsdl

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/DiscoveryService2"
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        if isinstance(response, doFullTextSearchResponse.typecode.pyclass) is False:
40            raise TypeError, "%s incorrect response type" % (response.__class__)
41        return response
42
43    # op: doPresent
44    def doPresent(self, request):
45        if isinstance(request, doPresentRequest) is False:
46            raise TypeError, "%s incorrect request type" % (request.__class__)
47        kw = {}
48        # no input wsaction
49        self.binding.Send(None, None, request, soapaction="None", **kw)
50        # no output wsaction
51        response = self.binding.Receive(doPresentResponse.typecode)
52        if isinstance(response, doPresentResponse.typecode.pyclass) is False:
53            raise TypeError, "%s incorrect response type" % (response.__class__)
54        return response
55
56doFullTextSearchRequest = ns0.doFullTextSearch_Dec().pyclass
57
58doFullTextSearchResponse = ns0.doFullTextSearchReturn_Dec().pyclass
59
60doPresentRequest = ns0.doPresent_Dec().pyclass
61
62doPresentResponse = ns0.doPresentReturn_Dec().pyclass
Note: See TracBrowser for help on using the repository browser.