{"id":402,"date":"2009-07-14T10:19:00","date_gmt":"2009-07-14T00:19:00","guid":{"rendered":"http:\/\/new.radio-active.net.au\/web3\/python-soaplib-with-vb-net-and-c\/"},"modified":"2014-10-10T12:15:32","modified_gmt":"2014-10-10T01:15:32","slug":"python-soaplib-with-vb-net-and-c","status":"publish","type":"post","link":"http:\/\/www.radio-active.net.au\/web3\/402","title":{"rendered":"Python SoapLib with VB.NET and C#"},"content":{"rendered":"<p>This is a rare post. It says how to do something, and it is something that I have spent a LOT of time investigating. It is not complete thanks to one or two issues, but it is close.<\/p>\n<p>Basically I wanted to write a service in Python and consume it in VB.NET. That should be easy. Well, it is, if you want to write your own Web Service code under .NET. I am lazy and do not like that idea. So you need to generate a WSDL from what I can work out. And this code does that for VB.NET and C#, at least in Visual Studio 2005. There is an issue though. Data types are not being sent correctly. I think this is an issue with SoapLib, but I cannot be sure. The GIT repository does not have any patches either. So this is CUTTING EDGE!<\/p>\n<p>Sorry about the lack of indent. I am sure you can work it out!<\/p>\n<p><tt><br \/>#!\/usr\/bin\/python<br \/>import web<br \/>from soaplib.wsgi_soap import SimpleWSGISoapApp<br \/>from soaplib.service import soapmethod<br \/>from soaplib.serializers import primitive as soap_types<br \/>from soaplib.serializers.primitive import String<\/p>\n<p>urls = (\"\/hello\", \"HelloService\",<br \/>       \"\/hello.wsdl\", \"HelloService\",<br \/>       )<br \/>render = web.template.Template(\"$def with (var)n$:var\")<\/p>\n<p>class SoapService(SimpleWSGISoapApp):<br \/>   \"\"\"Class for webservice \"\"\"<\/p>\n<p>   #__tns__ = 'http:\/\/test.com'<\/p>\n<p>#    @soapmethod(soap_types.String,_returns=soap_types.String)<br \/>   @soapmethod(String,_returns=String)<br \/>   def hello(self,message):<br \/>       \"\"\" Method for webservice\"\"\"<br \/>       return \"Hello world \"+message<\/p>\n<p>class HelloService(SoapService):<br \/>   \"\"\"Class for web.py \"\"\"<br \/>   def start_response(self,status, headers):<br \/>       web.ctx.status = status<br \/>       for header, value in headers:<br \/>           web.header(header, value)<\/p>\n<p>   def GET(self):<br \/>       response = super(SimpleWSGISoapApp, self).__call__(web.ctx.environ, self.start_response)<br \/>       return render(\"n\".join(response))<\/p>\n<p>   def POST(self):<br \/>       response = super(SimpleWSGISoapApp, self).__call__(web.ctx.environ, self.start_response)<br \/>       return render(\"n\".join(response))<\/p>\n<p>app=web.application(urls, globals())<\/p>\n<p>if __name__ == \"__main__\":<br \/>   app.run()<\/p>\n<p><\/tt><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a rare post. It says how to do something, and it is something that I have spent a LOT of time investigating. It is not complete thanks to one or two issues, but it is close. Basically I &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"http:\/\/www.radio-active.net.au\/web3\/402\"> <span class=\"screen-reader-text\">Python SoapLib with VB.NET and C#<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5cfmK-6u","_links":{"self":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts\/402"}],"collection":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/comments?post=402"}],"version-history":[{"count":0,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}