Exemplo n.º 1
0
def make_clients():
    print _service_name
    for name, method in _methods.items():
        _clients[name] = SimpleSoapClient('127.0.0.1:9753', '/', method)
    service = new.classobj(_service_name, (object, ), {})
    for operation, client in _clients.items():
        setattr(service, operation, client)
    return service
Exemplo n.º 2
0
    def _test_callback(self):
        inputs = [MethodDescriptor('person', Person)]

        client = SimpleSoapClient('127.0.0.1:9191', '/', 'e', inputs, None)
        p = Person()
        p.name = 'wilson'
        r = client(p)
        self.assertEquals(r, None)
Exemplo n.º 3
0
    def test_simple(self):
        inMessage = Message('a', [('s', String), ('i', Integer)])
        outMessage = Message('aResponse', [('retval', DateTime)])

        desc = MethodDescriptor('a', 'a', inMessage, outMessage, '')

        client = SimpleSoapClient('127.0.0.1:9191', '/', desc)
        results = client('abc', 54)
        self.assertEquals(results, datetime.datetime(1901, 12, 15))
Exemplo n.º 4
0
    def test_async(self):
        inMessage = Message('d', [('person', Person)])
        outMessage = Message('dResponse', [])

        desc = MethodDescriptor('d', 'd', inMessage, outMessage, '')

        client = SimpleSoapClient('127.0.0.1:9191', '/', desc)
        p = Person()
        p.name = 'wilson'
        r = client(p)
        self.assertEquals(r, None)
Exemplo n.º 5
0
    def test_fault(self):
        inMessage = Message('fault', [])
        outMessage = Message('faultResponse', [])
        desc = MethodDescriptor('fault', 'fault', inMessage, outMessage, '')

        client = SimpleSoapClient('127.0.0.1:9191', '/', desc)
        try:
            client()
        except Fault, f:
            self.assertEquals(f.faultcode, 'faultFault')
            self.assertEquals(f.faultstring, 'Testing faults')
            self.assertTrue(f.detail.find('client_test.py') > -1)
Exemplo n.º 6
0
    def test_nested(self):
        inMessage = Message('b', [('p', Person), ('s', String),
                                  ('i', Integer)])
        outMessage = Message('bResponse', [('retval', Address)])

        desc = MethodDescriptor('b', 'b', inMessage, outMessage, '')

        client = SimpleSoapClient('127.0.0.1:9191', '/', desc)
        p = Person()
        p.name = 'wilson'
        p.addresses = []
        for i in range(0, 123):
            a = Address()
            a.zip = i
            p.addresses.append(a)
        res = client(p, 'abc', 123)
        self.assertEquals(res.longitude, None)
        self.assertEquals(res.zip, 4444)
        self.assertEquals(res.street, 'wsgi way')