Hi, all:

Is someone familiar to SOAPpy?

First of all, I will admire I'm a newbie to soap, and SOAPpy can run
successfully in some occasions.

Now, my problem is:

# server_sum.py
import logging

import tornado.httpserver
import tornado.ioloop
import tornado.web
from tornadows import soaphandler
from tornadows import webservices
from tornadows import xmltypes
from tornadows.soaphandler import webservice
from tornado.options import define, options

define('mode', default='deploy')
define('port', type=int, default=8000)
options['logging'].set('warning')


class SumService(soaphandler.SoapHandler):

@webservice(_params=[xmltypes.Integer,xmltypes.Integer],_returns=xmltypes.Integer)
    def sum(self, a=1, b=1):
        result = a + b
        return result

if __name__ == '__main__':
    service = [('SumService',SumService)]
    app = webservices.WebService(service)
    ws  = tornado.httpserver.HTTPServer(app)
    ws.listen(options.port)
    logging.warn("SumService running on: localhost:%d", options.port)
    tornado.ioloop.IOLoop.instance().start()

# sum_client.py

from SOAPpy import SOAPProxy

def test_tornadows_sum():
    """test for tornadows
    """
    #TODO:in this way, invoking tornadows is also failed, what a pity.
    url = "http://localhost:8000/SumService";
    server = SOAPProxy(url)
    print dir(server)
    a = 22
    b = 44
    print server.sum(a,b)


------
The server is okay.when I invoke the method in this way, it return the sum
of 10 and 2.:
import suds
def test_tornadows_sum():
    # it's okay, while the server provide a method.
    url = "http://localhost:8000/SumService?wsdl";
    client = suds.client.Client(url)
    print 'client', client
    a = 10
    b = 2
    output = client.service.sum(a,b)

While, when i use SOAPProxy (sum_client.py), it failed. the errror message
is :

['_SOAPProxy__Method', '_SOAPProxy__call', '__doc__', '__getattr__',
'__init__', '__module__', '_callWithBody', 'config', 'encoding', 'header',
'http_proxy', 'invoke', 'methodattrs', 'namespace', 'noroot', 'proxy',
'simplify_objects', 'soapaction', 'throw_faults', 'transport',
'unwrap_results']
<SOAPpy.Types.structType Fault at 141277356>: {'faultcode': '',
'faultstring': 'Error in web service : unbound prefix: line 1, column 0'}

What should I do next ?

#NOTE: the wsdl for the server is:
http://172.16.2.46:8000/SumService?wsdl    # url is in my personal
computer, you can read the wsdl below.
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:tns="http://127.0.1.1:8000/SumService/sum"; xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"xmlns:xsd="http://www.w3.org/2001/XMLSchema
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; name="SumService"
targetNamespace="http://127.0.1.1:8000/SumService/sum";>
<wsdl:types>
<xsd:schema targetNamespace="http://127.0.1.1:8000/SumService/sum";>
<xsd:complexType name="paramsTypes">
<xsd:sequence>
<xsd:element name="a" type="xsd:integer"/>
<xsd:element name="b" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="params" type="tns:paramsTypes"/>
<xsd:element name="returns" type="xsd:integer"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="SumServiceRequest">
<wsdl:part element="tns:params" name="parameters"/>
</wsdl:message>
<wsdl:message name="SumServiceResponse">
<wsdl:part element="tns:returns" name="parameters"/>
</wsdl:message>
<wsdl:portType name="SumServicePortType">
<wsdl:operation name="sum">
<wsdl:input message="tns:SumServiceRequest"/>
<wsdl:output message="tns:SumServiceResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SumServiceBinding" type="tns:SumServicePortType">
<soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sum">
<soap:operation soapAction="http://127.0.1.1:8000/SumService"; style="
document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SumService">
<wsdl:port binding="tns:SumServiceBinding" name="SumServicePort">
<soap:address location="http://127.0.1.1:8000/SumService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Any help will be highly appreciated. Thanks for your time and concentration
again!

-- Jia Xiaolei
_______________________________________________
Soap mailing list
[email protected]
http://mail.python.org/mailman/listinfo/soap

Reply via email to