473,394 Members | 1,491 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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
[SoapDocumentService(Use=SoapBindingUse.Literal,
ParameterStyle=SoapParameterStyle.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('http://localhost/MyWebServices/FirstService.asmx?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 4224
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
[SoapDocumentService(Use=SoapBindingUse.Literal,
ParameterStyle=SoapParameterStyle.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('http://localhost/MyWebServices/FirstService.asmx?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(Namespace=...] line):

[SoapDocumentService (Use=SoapBindingUse.Encoded)]

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

using System.Web.Services.Protocols;
using System.Web.Services.Description;
using System.Xml.Serialization;

So for anyone else that is having this problem, the solution is the
combination of the two: (1) You must ad the [SoapDocumentService
(Use=SoapBindingUse.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.*******@betternet.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
[SoapDocumentService(Use=SoapBindingUse.Literal,
ParameterStyle=SoapParameterStyle.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('http://localhost/MyWebServices/FirstService.asmx?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
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>'; ?>...
0
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...
1
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...
5
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...
1
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...
5
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,...
2
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...
0
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...
4
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"...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.