예제 #1
0
파일: server.py 프로젝트: rgoliveira/forca
            ##print response

    if '--serve' in sys.argv:
        print "Starting server..."
        httpd = HTTPServer(("", 8008), SOAPHandler)
        httpd.dispatcher = dispatcher
        httpd.serve_forever()

    if '--consume' in sys.argv:
        from client import SoapClient
        client = SoapClient(
            location="http://localhost:8008/",
            action='http://localhost:8008/',  # SOAPAction
            namespace="http://example.com/sample.wsdl",
            soap_ns='soap',
            trace=True,
            ns=False)
        response = client.Adder(p={
            'a': 1,
            'b': 2
        },
                                dt='20100724',
                                c=[{
                                    'd': '1.20'
                                }, {
                                    'd': '2.01'
                                }])
        result = response.AddResult
        print int(result.ab)
        print str(result.dd)
예제 #2
0
            request, response, doc = dispatcher.help(method)

    if '--serve' in sys.argv:
        log.info("Starting server...")
        httpd = HTTPServer(("", 8008), SOAPHandler)
        httpd.dispatcher = dispatcher
        httpd.serve_forever()

    if '--wsgi-serve' in sys.argv:
        log.info("Starting wsgi server...")
        from wsgiref.simple_server import make_server
        application = WSGISOAPHandler(dispatcher)
        wsgid = make_server('', 8008, application)
        wsgid.serve_forever()

    if '--consume' in sys.argv:
        from client import SoapClient
        client = SoapClient(
            location="http://localhost:8008/",
            action='http://localhost:8008/',  # SOAPAction
            namespace="http://example.com/sample.wsdl",
            soap_ns='soap',
            trace=True,
            ns=False)
        p = {'a': 1, 'b': 2}
        c = [{'d': '1.20'}, {'d': '2.01'}]
        response = client.Adder(p=p, dt='20100724', c=c)
        result = response.AddResult
        log.info(int(result.ab))
        log.info(str(result.dd))