Closed GoogleCodeExporter closed 8 years ago
I do more test.
And pysimplesoap.client.SoapClient with WSDL may have a bug to set the
incorrect namespace.
Below is the generated xml by SoupUI.
========================================================================
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.restfulwebservices.net/ServiceContracts/2008/01">
<soapenv:Header/>
<soapenv:Body>
<ns:GetCitiesByCountry>
<!--Optional:-->
<ns:Country>korea</ns:Country>
</ns:GetCitiesByCountry>
</soapenv:Body>
</soapenv:Envelope>
========================================================================
I compare this xml code with my xml code.
And I found that pysimpleapi set the incorrect namespace.
The namespace may be
"http://www.restfulwebservices.net/ServiceContracts/2008/01" not
"http://www.restfulwebservices.net/ServiceContracts/2008/01/Imports".
Following code set the namespace to
"http://www.restfulwebservices.net/ServiceContracts/2008/01" temporarily.
And works well.
========================================================================
# -*- coding: utf-8 -*-
import logging
import pysimplesoap.client
import pprint
def test_pysimplesoap():
wsdl='http://www.restfulwebservices.net/wcf/WeatherForecastService.svc?wsdl'
client = pysimplesoap.client.SoapClient(wsdl=wsdl, #soap_ns="soapenv",
#ns="ns",
#namespace="http://www.restfulwebservices.net/ServiceContracts/2008/01",
trace=True)
client.namespace="http://www.restfulwebservices.net/ServiceContracts/2008/01"
ret = client.GetCitiesByCountry("KOREA")
print ret
if __name__ == "__main__":
test_pysimplesoap()
========================================================================
SOAPAction: "GetCitiesByCountry"
Content-length: 406
Content-type: text/xml; charset="UTF-8"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header/>
<soap:Body>
<GetCitiesByCountry xmlns="http://www.restfulwebservices.net/ServiceContracts/2008/01">
<Country>KOREA</Country></GetCitiesByCountry>
</soap:Body>
</soap:Envelope>
status: 200
content-length: 1893
x-powered-by: ASP.NET
vary: Accept-Encoding
server: Microsoft-IIS/7.0
-content-encoding: gzip
date: Thu, 21 Feb 2013 08:42:34 GMT
content-type: text/xml; charset=utf-8
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetCiti
esByCountryResponse xmlns="http://www.restfulwebservices.net/ServiceContracts/20
08/01"><GetCitiesByCountryResult xmlns:a="http://schemas.microsoft.com/2003/10/S
erialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:stri
ng>KWANGJU</a:string><a:string>KUNSAN</a:string><a:string>MOKPO</a:string><a:str
ing>JHUNJU</a:string><a:string>YEOSU</a:string><a:string>CHUNCHON</a:string><a:s
tring>SOKCH'O</a:string><a:string>HEONGSUNG</a:string><a:string>INJAE</a:string>
<a:string>KWANDAERI</a:string><a:string>KANGNUNG</a:string><a:string>SAMCHOK</a:
string><a:string>WONJU</a:string><a:string>YANGKU</a:string><a:string>CHEJU</a:s
tring><a:string>CHINHAE</a:string><a:string>KIMHAE</a:string><a:string>CHEJU</a:
string><a:string>BUSAN</a:string><a:string>SACHON</a:string><a:string>ULSAN</a:s
tring><a:string>ASCOM CITY</a:string><a:string>UIJEONGBU</a:string><a:string>CHE
ONGOKRI</a:string><a:string>PAEKRYOUNGDO BEACH</a:string><a:string>KOREAN AIR FO
RCE HQ</a:string><a:string>PYONGTAEK</a:string><a:string>SUSAEK</a:string><a:str
ing>SEOUL EAST</a:string><a:string>KUNI</a:string><a:string>OSAN</a:string><a:st
ring>PAEKRYOUNGDO SITE</a:string><a:string>YEONGDONGRI</a:string><a:string>SEOUL
</a:string><a:string>TONGDUCHEON</a:string><a:string>YEOJU</a:string><a:string>S
UWON</a:string><a:string>SONG SAN-RI</a:string><a:string>SEOUL</a:string><a:stri
ng>ANDONG</a:string><a:string>CHUNGJU</a:string><a:string>TAEJON</a:string><a:st
ring>POHANG</a:string><a:string>KYUNGJU</a:string><a:string>TAEGU</a:string><a:s
tring>SANGJU</a:string><a:string>CHONGJU</a:string><a:string>YECHON</a:string><a
:string>HAMHUNG</a:string><a:string>KIMCHAEK</a:string><a:string>PYONGYANG</a:st
ring><a:string>UAMA</a:string><a:string>UIJU</a:string></GetCitiesByCountryResul
t></GetCitiesByCountryResponse></s:Body></s:Envelope>
================================================================================
{'GetCitiesByCountryResult': [{'string': u'KWANGJU'}, {'string': u'KUNSAN'}, {'s
tring': u'MOKPO'}, {'string': u'JHUNJU'}, {'string': u'YEOSU'}, {'string': u'CHU
NCHON'}, {'string': u"SOKCH'O"}, {'string': u'HEONGSUNG'}, {'string': u'INJAE'},
{'string': u'KWANDAERI'}, {'string': u'KANGNUNG'}, {'string': u'SAMCHOK'}, {'st
ring': u'WONJU'}, {'string': u'YANGKU'}, {'string': u'CHEJU'}, {'string': u'CHIN
HAE'}, {'string': u'KIMHAE'}, {'string': u'CHEJU'}, {'string': u'BUSAN'}, {'stri
ng': u'SACHON'}, {'string': u'ULSAN'}, {'string': u'ASCOM CITY'}, {'string': u'U
IJEONGBU'}, {'string': u'CHEONGOKRI'}, {'string': u'PAEKRYOUNGDO BEACH'}, {'stri
ng': u'KOREAN AIR FORCE HQ'}, {'string': u'PYONGTAEK'}, {'string': u'SUSAEK'}, {
'string': u'SEOUL EAST'}, {'string': u'KUNI'}, {'string': u'OSAN'}, {'string': u
'PAEKRYOUNGDO SITE'}, {'string': u'YEONGDONGRI'}, {'string': u'SEOUL'}, {'string
': u'TONGDUCHEON'}, {'string': u'YEOJU'}, {'string': u'SUWON'}, {'string': u'SON
G SAN-RI'}, {'string': u'SEOUL'}, {'string': u'ANDONG'}, {'string': u'CHUNGJU'},
{'string': u'TAEJON'}, {'string': u'POHANG'}, {'string': u'KYUNGJU'}, {'string'
: u'TAEGU'}, {'string': u'SANGJU'}, {'string': u'CHONGJU'}, {'string': u'YECHON'
}, {'string': u'HAMHUNG'}, {'string': u'KIMCHAEK'}, {'string': u'PYONGYANG'}, {'
string': u'UAMA'}, {'string': u'UIJU'}]}
Original comment by marun...@gmail.com
on 21 Feb 2013 at 9:08
First, self.namespace in SoapClient instance set to correct value at 460 line
in client.py
=============================================================
# Extract useful data:
self.namespace = wsdl['targetNamespace']
=============================================================
But, self.namespace set to incorrect value at 591 line.
=============================================================
# check axis2 namespace at schema types attributes
self.namespace = dict(wsdl.types("schema", ns=xsd_uri)[:]).get('targetNamespace', self.namespace)
=============================================================
Original comment by marun...@gmail.com
on 28 Feb 2013 at 6:53
sorry, I don't fully understand this, do you have a patch or fix?
Original comment by reingart@gmail.com
on 28 Feb 2013 at 9:21
I don't have a patch or fix.
I am a beginner for web service(soap,wsdl) and pysimplesoap.
I only test and compare it with other libraries and tools.
Original comment by marun...@gmail.com
on 4 Mar 2013 at 4:09
This appears to be working now in trunk with the latest changes (version 1.11,
revision a16a09aa50ea):
https://code.google.com/p/pysimplesoap/source/detail?r=a16a09aa50ea01544ed7e5439
dfb63bed65bf8a8
The remote call returns:
ret = {'GetCitiesByCountryResult': [{'string': u'KWANGJU'}, {'string':
u'KUNSAN'}, {'string': u'MOKPO'}, {'string': u'JHUNJU'}, {'string': u'YEOSU'},
{'string': u'CHUNCHON'}, {'string': u"SOKCH'O"}, {'string': u'HEONGSUNG'},
{'string': u'INJAE'}, {'string': u'KWANDAERI'}, {'string': u'KANGNUNG'},
{'string': u'SAMCHOK'}, {'string': u'WONJU'}, {'string': u'YANGKU'}, {'string':
u'CHEJU'}, {'string': u'CHINHAE'}, {'string': u'KIMHAE'}, {'string': u'CHEJU'},
{'string': u'BUSAN'}, {'string': u'SACHON'}, {'string': u'ULSAN'}, {'string':
u'ASCOM CITY'}, {'string': u'UIJEONGBU'}, {'string': u'CHEONGOKRI'}, {'string':
u'PAEKRYOUNGDO BEACH'}, {'string': u'KOREAN AIR FORCE HQ'}, {'string':
u'PYONGTAEK'}, {'string': u'SUSAEK'}, {'string': u'SEOUL EAST'}, {'string':
u'KUNI'}, {'string': u'OSAN'}, {'string': u'PAEKRYOUNGDO SITE'}, {'string':
u'YEONGDONGRI'}, {'string': u'SEOUL'}, {'string': u'TONGDUCHEON'}, {'string':
u'YEOJU'}, {'string': u'SUWON'}, {'string': u'SONG SAN-RI'}, {'string':
u'SEOUL'}, {'string': u'ANDONG'}, {'string': u'CHUNGJU'}, {'string':
u'TAEJON'}, {'string': u'POHANG'}, {'string': u'KYUNGJU'}, {'string':
u'TAEGU'}, {'string': u'SANGJU'}, {'string': u'CHONGJU'}, {'string':
u'YECHON'}, {'string': u'HAMHUNG'}, {'string': u'KIMCHAEK'}, {'string':
u'PYONGYANG'}, {'string': u'UAMA'}, {'string': u'UIJU'}]}
(test pending)
Original comment by reingart@gmail.com
on 29 Aug 2013 at 8:45
The error is fixed in the latest developement version 1.12
Please download and test the latest source code from the repository until the
release:
https://pysimplesoap.googlecode.com/archive/default.zip
Added a test in revision bd14457ab3eb
Original comment by reingart@gmail.com
on 22 Jan 2014 at 4:38
[deleted comment]
This bug is a pretty much a show stopper for interop between .NET WCF services.
Even if you utilize the new .NET 4.5 "singleWsdl" feature, you will still
encounter this issue with xml imports when using complex type paramters, if the
namespace defined in the attribute [ServiceContract(NameSpace="www.Service")]
isn't the same as the namespace in [DataContract(Namespace="www.Contract")].
Is this fix being planned be released in a new stable version any time soon?
Original comment by d.li...@gmail.com
on 3 Sep 2014 at 6:57
Attachments:
Thanks for reporting and providing the wsdl, I'm planning to make a new release
soon (maybe later this month), after fixing some important open issues.
In the meantime, you can download 1.12 from
https://pysimplesoap.googlecode.com/archive/1.12.zip (or even 1.13) and try it,
let me know if that solves your problem to see if this bug is a regression.
Original comment by reingart@gmail.com
on 3 Sep 2014 at 7:04
I have already verified that 1.12 fixes these issues. Thanks for the quick
update! We will be eagerly waiting for the new release :D
Original comment by d.li...@gmail.com
on 3 Sep 2014 at 7:29
Original issue reported on code.google.com by
marun...@gmail.com
on 19 Feb 2013 at 10:30