SOAP can really be a world of pain.  I spent hours trying to connect to a 
SOAP service and the best I could get was a "400 Bad Request".  It turned 
out that they were using wsHttpBinding - which seems to only be supported 
by .NET clients.  The work-around is to manually inject the WS-Security 
headers into the SOAP envelope.  In the end I gave up and reverted to a 
service using basicHttp binding.

Long story, short: pysimplesoap works really well.  It is SOAP itself that 
is overly complex and mostly broken.

And for anyone out there experiencing the pain, here's some sample code 
that I use as a sanity check.  The 'trace' option leaves a nice trail on 
the console - but remember to turn it off in production.

            from gluon.contrib.pysimplesoap.client import SoapClient, 
SoapFault
            url = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL";
            client = SoapClient(wsdl=url, trace = True) 
                
            parameters = {}
            parameters['ZIP'] = 90210
            
            try:
                response = client.GetCityWeatherByZIP(**parameters)         
            except SoapFault as e:
                response = "ERROR {0}: {1}".format(e.faultcode, 
e.faultstring)


On Thursday, 25 June 2015 06:32:00 UTC+12, Dave S wrote:
>
>
>
> On Wednesday, June 24, 2015 at 4:39:57 AM UTC-7, Encompass solutions wrote:
>>
>> Found it.  it's in the init.py file in gluon/contrib/pysimplesoap/
>> It's version 1.11 which is a little behind, but there are some regression 
>> as of last year, we should check before bumping up the version.
>>
>>
> FWIW, I also use pysimplesoap (it's what brought me to web2py), both with 
> a third party target and with my own SOAP target.  It works well with these.
>
> I tried using it with a different third party target that had some special 
> WSDL handling required , and I wasn't successful with that.  I had some 
> conversations here about it, and the dev (M Reingart) tried to help, but I 
> didn't know my way around the code well enough to nail things down, and 
> didn't have time then to come more up to speed.  (I have a TooManyTabs 
> bookmark for "Fixing Broken WSDL")
>
>
> /dps
>
>
>
>> On Wednesday, June 24, 2015 at 9:52:08 AM UTC+3, Encompass solutions 
>> wrote:
>>>
>>> I am trying to use soap and I am comming across errors from 2012 is the 
>>> version included in web2py always the latest with each new version of 
>>> web2py?  I do I check what version is included?
>>> I am getting a Tag not found: service (No elements found) error when 
>>> trying to get the wsdl file. (The file seems very good and well tested)
>>> BR,
>>> Jason
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to