那么这是我的fisrt问题,所以我会尽力做到最好.
我正在尝试使用Soaplib 2.0在Python 2.6和Django 1.4中实现WebService服务器.
Web服务正在运行,Django在Django开发服务器中正常运行.
这是Django View和Urls的代码:
views.py
from soaplib.core.service import rpc, DefinitionBase, soap
from soaplib.core.model.primitive import String, Integer, Boolean
from soaplib.core.model.clazz import Array
from soaplib.core import Application
from soaplib.core.server.wsgi import Application as WSGIApplication
from django.http import HttpResponse
class HelloWorldService(DefinitionBase):
@soap(String,Integer,_returns=Array(String))
def say_smello(self,name,times):
results = []
for i in range(0,times):
results.append('Hello, %s'%name)
return results
@soap(String,_returns=Boolean)
def xml(self,xml):
result = xml
return True
@soap(String,_returns=String)
def xml2(self,xml2):
return xml2
class DjangoSoapApp(WSGIApplication):
csrf_exempt = True
def __init__(self, services, tns):
"""Create Django view …Run Code Online (Sandbox Code Playgroud)