I have written a python webservice using saoplib
我用saoplib编写了一个python webservice
my python web service code :
我的python Web服务代码:
import soaplib
from soaplib.core.service import rpc, DefinitionBase,soap
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array
class HelloWorldService(DefinitionBase):
@soap(String,_returns=String)
def say_hello(self,name):
f=open("/tmp/f.txt","w+")
f.write(name)
f.close()
return name
if __name__=='__main__':
try:
from wsgiref.simple_server import make_server
soap_application = soaplib.core.Application([HelloWorldService], 'tns')
wsgi_application = wsgi.Application(soap_application)
server = make_server('46.36.119.230', 7789, wsgi_application)
server.serve_forever()
except ImportError:
print "Error: example server code requires Python >= 2.5"
I want to call it from my c# application.So how do i call it say_hello
method?
我想从我的c#应用程序中调用它。所以我怎么称它为say_hello方法?
1 个解决方案
#1
First add your webservice to C# using this address
首先使用此地址将您的Web服务添加到C#
http://46.36.119.230:7789/?wsdl
Then you can call the say_hello
method this way:
然后你可以这样调用say_hello方法:
ServiceReference1.ApplicationClient h = new ApplicationClient();
say_hello ss = new say_hello();
ss.name = "saeed";
say_helloResponse rs = h.say_hello(ss);
MessageBox.Show(rs.say_helloResult);
#1
First add your webservice to C# using this address
首先使用此地址将您的Web服务添加到C#
http://46.36.119.230:7789/?wsdl
Then you can call the say_hello
method this way:
然后你可以这样调用say_hello方法:
ServiceReference1.ApplicationClient h = new ApplicationClient();
say_hello ss = new say_hello();
ss.name = "saeed";
say_helloResponse rs = h.say_hello(ss);
MessageBox.Show(rs.say_helloResult);