1

I have written a python webservice using saoplib

my python web service code :

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?

Saeed Ghareh Daghi
  • 1,164
  • 1
  • 13
  • 21
  • That's a lot to ask for. You probably need to use some c# clas that descends from this: https://msdn.microsoft.com/en-us/library/microsoft.web.services3.messaging.soapclient.aspx – Robert Moskal May 02 '15 at 16:26

1 Answers1

1

First add your webservice to C# using this address

http://46.36.119.230:7789/?wsdl

Then you can call the say_hello method this way:

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);
Ghasem
  • 14,455
  • 21
  • 138
  • 171