Exemplo n.º 1
0
def test_full_request_response():
    service = Service("Boo", "http://boo")
    service.schema(xs.complexType("Foo")(xs.sequence()(xs.element("foo", xs.string, maxOccurs=xs.unbounded))))

    @service.expose(xs.element("fooReq", "Foo"), "Foo")
    def foo(request):
        return {"foo": [r + "foo" for r in request.foo]}

    open("/tmp/wow.xml", "w").write(service.get_wsdl("http://localhost/"))

    cl = Client("some address", transport=DirectSudsTransport(service), cache=None)
    result = cl.service.foo(["one", "two"])
    assert result == ["onefoo", "twofoo"]
Exemplo n.º 2
0
def test_aliased_types_in_params():
    service = Service("Boo", "http://boo")

    service.schema(xs.complexType(name="paramType")(xs.sequence()(xs.element("foo", xs.string))))

    @service.expose(response=xs.string)
    def concat(param=xs.array("paramType")):
        return "".join(r.foo for r in param)

    open("/tmp/wow.xml", "w").write(service.get_wsdl("http://localhost/"))

    cl = Client("some address", transport=DirectSudsTransport(service), cache=None)

    result = cl.service.concat([{"foo": "boo"}, {"foo": "bar"}])
    assert result == "boobar"
Exemplo n.º 3
0
def test_full_request_response():
    service = Service('Boo', 'http://boo')
    service.schema(
        xs.complexType('Foo')(xs.sequence()(xs.element(
            'foo', xs.string, maxOccurs=xs.unbounded))))

    @service.expose(xs.element('fooReq', 'Foo'), 'Foo')
    def foo(request):
        return {'foo': [r + 'foo' for r in request.foo]}

    open('/tmp/wow.xml', 'w').write(service.get_wsdl('http://localhost/'))

    cl = Client('some address',
                transport=DirectSudsTransport(service),
                cache=None)
    result = cl.service.foo(['one', 'two'])
    assert result == ['onefoo', 'twofoo']
Exemplo n.º 4
0
def test_aliased_types_in_params():
    service = Service('Boo', 'http://boo')

    service.schema(
        xs.complexType(name='paramType')(xs.sequence()(xs.element(
            'foo', xs.string))))

    @service.expose(response=xs.string)
    def concat(param=xs.array('paramType')):
        return ''.join(r.foo for r in param)

    open('/tmp/wow.xml', 'w').write(service.get_wsdl('http://localhost/'))

    cl = Client('some address',
                transport=DirectSudsTransport(service),
                cache=None)

    result = cl.service.concat([{'foo': 'boo'}, {'foo': 'bar'}])
    assert result == 'boobar'