473,748 Members | 6,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems getting Python client (SOAPpy) to consume .NET web services

I have begun experimenting with web services, and I created some
simple web services in C# and was able to install them with IIS and
create an equally simple C# client to consume them.

My next experiment was to use Python to consume these same web
services, and even though I am able to get Python to consume web
services from a variety of sources (Apache SOAP, Glue, AXIS), I cannot
get web services created with MS.NET to work. Actually, methods with
no arguments work fine, but any methods that take arguments do not
work. There is no error, it is simply that an incorrect result is
returned (i.e. my simple Add(int a, int b) web service always returns
zero).

I tried playing around with the
[SoapDocumentSer vice(Use=SoapBi ndingUse.Litera l,
ParameterStyle= SoapParameterSt yle.Wrapped)] arguments in .NET, but I
have had no success as of yet. I don't think it's just me since I
cannot consume any of the web services on webmethods.net that are
created using MS.NET.

My Python code looks something like this:

from SOAPpy import WSDL
server = WSDL.Proxy('htt p://localhost/MyWebServices/FirstService.as mx?WSDL')
server.SayHello () # works correctly - just prints a hello message
server.Add(3, 4) # does not work - returns zero

Any tip that would point me in the right direction would be greatly
appreciated!
Jul 18 '05 #1
2 4254
Michael Hatmaker wrote:
I have begun experimenting with web services, and I created some
simple web services in C# and was able to install them with IIS and
create an equally simple C# client to consume them.

My next experiment was to use Python to consume these same web
services, and even though I am able to get Python to consume web
services from a variety of sources (Apache SOAP, Glue, AXIS), I cannot
get web services created with MS.NET to work. Actually, methods with
no arguments work fine, but any methods that take arguments do not
work. There is no error, it is simply that an incorrect result is
returned (i.e. my simple Add(int a, int b) web service always returns
zero).

I tried playing around with the
[SoapDocumentSer vice(Use=SoapBi ndingUse.Litera l,
ParameterStyle= SoapParameterSt yle.Wrapped)] arguments in .NET, but I
have had no success as of yet. I don't think it's just me since I
cannot consume any of the web services on webmethods.net that are
created using MS.NET.

My Python code looks something like this:

from SOAPpy import WSDL
server = WSDL.Proxy('htt p://localhost/MyWebServices/FirstService.as mx?WSDL')
server.SayHello () # works correctly - just prints a hello message
server.Add(3, 4) # does not work - returns zero

Any tip that would point me in the right direction would be greatly
appreciated!

I tried this some time before, too. Actually cannot remember, if I finally
succeeded. I think using keyword arguments in Python got me one step further, e.g.:
server.Add(a=3, b=4)
Jul 18 '05 #2
Nice catch! Actually, I had tried that once, but there is one more
trick to make this work (that I had since added). You must add the
following line in your C# web service (I put it before the
[WebService(Name space=...] line):

[SoapDocumentSer vice (Use=SoapBindin gUse.Encoded)]

(and I also think you need to import the following:)

using System.Web.Serv ices.Protocols;
using System.Web.Serv ices.Descriptio n;
using System.Xml.Seri alization;

So for anyone else that is having this problem, the solution is the
combination of the two: (1) You must ad the [SoapDocumentSer vice
(Use=SoapBindin gUse.Encoded)] line to your web service (along with all
the appropriate "using" statements shown above) and (2) you must
specify the arguments by name in the method call like "server.Add(a=3 ,
b=5)".

Phew. Thanks again for making me go back and take a look at that named
arguments thing. I still don't know if there is hope for using a .NET
web service that I didn't write (such as those on www.xmethods.net),
but I'll be sure to let everyone know if I find a solution.

Benjamin Niemann <b.*******@bett ernet.de> wrote in message news:<ci******* ***@online.de>. ..
Michael Hatmaker wrote:
I have begun experimenting with web services, and I created some
simple web services in C# and was able to install them with IIS and
create an equally simple C# client to consume them.

My next experiment was to use Python to consume these same web
services, and even though I am able to get Python to consume web
services from a variety of sources (Apache SOAP, Glue, AXIS), I cannot
get web services created with MS.NET to work. Actually, methods with
no arguments work fine, but any methods that take arguments do not
work. There is no error, it is simply that an incorrect result is
returned (i.e. my simple Add(int a, int b) web service always returns
zero).

I tried playing around with the
[SoapDocumentSer vice(Use=SoapBi ndingUse.Litera l,
ParameterStyle= SoapParameterSt yle.Wrapped)] arguments in .NET, but I
have had no success as of yet. I don't think it's just me since I
cannot consume any of the web services on webmethods.net that are
created using MS.NET.

My Python code looks something like this:

from SOAPpy import WSDL
server = WSDL.Proxy('htt p://localhost/MyWebServices/FirstService.as mx?WSDL')
server.SayHello () # works correctly - just prints a hello message
server.Add(3, 4) # does not work - returns zero

Any tip that would point me in the right direction would be greatly
appreciated!

I tried this some time before, too. Actually cannot remember, if I finally
succeeded. I think using keyword arguments in Python got me one step further, e.g.:
server.Add(a=3, b=4)

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2048
by: leke | last post by:
Hi, I am trying to learn PHP but am having some problems getting my code running in Explorer 6. <html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body>
0
1201
by: flamesrock | last post by:
First, my problem doesn't make much practical sense so I hope you're up for a challenge. What I have (in concept) is a standalone web client that connects different 'players' to a central host and distributes game files between them. A user claims certain files, plays them, and then automatically uploads them to the site where they are subsequently distributed. What I want to do is have a secure system that lets users log in upon
1
2067
by: Ron Davis | last post by:
I have recently discovered Python and like it quite a bit. I would like to use it on a new project I am starting. The project will gather data from several web services and present the collected data to browser users through a web server. So basically I need a full-time web server and a separate way to poll web services for their data. There is no database involved. The problem is that I have tried several Python web servers...
5
2219
by: gel | last post by:
Hi I have written a python client server app that keeps an eye on processes starting and ending on a client and makes decision on what to do based on information from the server end. I want to run the client end of the app more or less invisibly (no console) on the XP clients when ever a users logs on. What would be the best way to get this done? A bit more info on the purpose of the app... it is to act as a licence server, where we...
1
2835
by: irfanhab | last post by:
Hey guys! I am having some serious problems integrating Python and C, and it's strange. Putting it simple, Just as I include Python.h in my C programe (without any further python interfacing code), and compile my C code with the options -I /usr/include/python2.4 -lpython2.4 too gcc, I get the following "warning" ===== In file included from /usr/include/python2.4/Python.h:8,
5
1658
by: paw | last post by:
I have ran the MSI installer for Python 2.5 several times attempting to install to C: Python, however all of the files are placed in C:\ . The installer is told to only install files for me, beyond that I have only chosen the defaults. If I copy the files after installation, then uninstall Python, I can still use the application. However I am unable to install py2exe since it does not see Python in the registry, py2exe refuses to...
2
1557
by: mohit | last post by:
Hello, I am a .NET developer experimenting with Python. I need to consume a .NET web service in a Python client. how do I go about it? which libraries do i need? pointers to help me get started would be much appreciated. I am just a newbie to the Python world so please be bear with my novice queries.
0
955
by: Yansky | last post by:
Hi, I'm having a lot of problems getting any Python scripts to run on my website. I have put them in the cgi-bin directory and chmodded both the directory and files to 755. But when I try to access the script, I get a 404 error: http://forboden.com/cgi-bin/wp.py I also tried running them from another directory and giving the directory its own .htaccess file containing: Options +ExecCGI AddHandler cgi-script .py
4
1799
by: lafayettejohnson | last post by:
there are 3 files but the one iam having problems with is the student.cpp student.cpp #include <iostream> // for ostream << and istream >> #include <string> #include "student.h" using namespace std;
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.