Dechenjm / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

Wrong result generated. #165

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I'm getting a dict value of None.

The debug shows that response is ok:
DEBUG:pysimplesoap.client:<s:Envelope 
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><ActivityId 
CorrelationId="5c1a8400-b9ff-4df4-a70e-199f497312ae" 
xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">54b36a01-b
b90-4b1d-b6f9-705e533a607d</ActivityId></s:Header><s:Body><GetLanguagesListRespo
nse 
xmlns="http://wcf.isolutions.it/ISBets.API.Common/1.0/"><GetLanguagesListResult 
xmlns:a="http://schemas.datacontract.org/2004/07/ISBets.API.Common.Messages.Resp
onses" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><_ResultCode 
xmlns="http://schemas.datacontract.org/2004/07/ISBets.API.Messages.Responses">Ok
</_ResultCode><_ResultDescription 
xmlns="http://schemas.datacontract.org/2004/07/ISBets.API.Messages.Responses"/><
a:_Languages 
xmlns:b="http://schemas.datacontract.org/2004/07/ISBets.API.Common"><b:Languages
.Language><b:Language>English</b:Language><b:LanguageID>2</b:LanguageID></b:Lang
uages.Language></a:_Languages></GetLanguagesListResult></GetLanguagesListRespons
e></s:Body></s:Envelope>

But in a result dictionary LanguageID is None.

What is the expected output? What do you see instead?
Expected:
{'GetLanguagesListResult': {'_ResultCode': u'Ok', '_ResultDescription': None, 
'_Languages': [{'Languages.Language': {'Language': u'English', 'LanguageID': 
2}}]}}

I'm getting:
{'GetLanguagesListResult': {'_ResultCode': u'Ok', '_ResultDescription': None, 
'_Languages': [{'Languages.Language': {'Language': u'English', 'LanguageID': 
None}}]}}

What version of the product are you using? On what operating system?
Latest from github

Please attach the related WSDL (if any), a small code fragment to reproduce
and provide any additional information below.

Original issue reported on code.google.com by kurvy...@gmail.com on 4 Nov 2014 at 2:10

GoogleCodeExporter commented 9 years ago
xml requests from soapUI
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ns="http://wcf.isolutions.it/ISBets.API.Common/1.0/" 
xmlns:isb="http://schemas.datacontract.org/2004/07/ISBets.API.Messages.Requests"
>
   <soapenv:Header/>
   <soapenv:Body>
      <ns:GetLanguagesList>
         <!--Optional:-->
         <ns:objRequest>
            <isb:_APIAccount>account</isb:_APIAccount>
            <isb:_APIPassword>pass</isb:_APIPassword>
            <isb:_IDBookmaker>1</isb:_IDBookmaker>
         </ns:objRequest>
      </ns:GetLanguagesList>
   </soapenv:Body>
</soapenv:Envelope>

this code:
for service in client.services.values():
    for port in service['ports'].values():
        print port['location']
        for op in port['operations'].values():
            print 'Name:', op['name']
            print 'Docs:', op['documentation'].strip()
            print 'SOAPAction:', op['action']
            print 'Input', op['input'] # args type declaration
            print

shows that:
Name: GetLanguagesList
Docs: None
SOAPAction: 
http://wcf.isolutions.it/ISBets.API.Common/1.0/ICommon/GetLanguagesList
Input {'GetLanguagesList': {u'objRequest': {u'_APIAccount': <type 'str'>, 
u'_APIPassword': <type 'str'>, u'_IDBookmaker': <alias 'short' for '<type 
'int'>'>, u'_LanguageID': {}, u'_DateExchangeRates': <type 
'datetime.datetime'>}}}

_LanguageID': {} - is an empty dict. Maybe there is a problem, why I'm getting 
"None"

Original comment by kurvy...@gmail.com on 4 Nov 2014 at 2:24

GoogleCodeExporter commented 9 years ago
sorry for the mess, i have fixed the bug:
there was a problem with the type called "unsignedByte"
from documentation it's a number from 0 to 255
http://books.xmlschemata.org/relaxng/ch19-77327.html

so i added two lines to helpers.py 
unsignedByte = Alias(int, 'integer')

and in TYPE_MAP = {
...
unsignedByte: 'unsignedByte',}

Original comment by Chy...@gmail.com on 6 Nov 2014 at 8:02