Closed Kilavagora closed 8 years ago
I am using zeep 0.7.0.dev0. The following
from zeep import Client from zeep.transports import Transport from zeep.cache import SqliteCache cache=SqliteCache(persistent=False, timeout=60) transport = Transport(cache=cache,verify=False) wsdl='https://webservices.netsuite.com/wsdl/v2016_1_0/netsuite.wsdl' client=Client(wsdl,transport=transport) Passport=client.get_type('ns0:Passport') RecordRef=client.get_type('ns0:RecordRef') myrole=RecordRef(internalId='1111') passport=Passport(account='123456', email='obviously@fake.email', password='password', role=myrole ) response=client.service.login(passport)
gives this error:
zeep.exceptions.Fault: org.xml.sax.SAXException: None is not a legal value for {urn:types.core_2016_1.platform.webservices.netsuite.com}RecordType
My understanding is that service does not expect the passed attributes with None values:
<ns0:role internalId="1111" externalId="None" type="None" typeId="None" scriptId="None"/>
If you directly post the payload without these attributes, it gives correct response about invalid credentials:
import requests headers={'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': 'login'} #attrs='externalId="None" type="None" typeId="None" scriptId="None"' attrs='' payload="""<?xml version="1.0" ?> <soap-env:Envelope xmlns:ns0="urn:core_2016_1.platform.webservices.netsuite.com" xmlns:ns1="urn:faults_2016_1.platform.webservices.netsuite.com" xmlns:ns10="urn:support_2016_1.lists.webservices.netsuite.com" xmlns:ns11="urn:types.support_2016_1.lists.webservices.netsuite.com" xmlns:ns12="urn:accounting_2016_1.lists.webservices.netsuite.com" xmlns:ns13="urn:types.accounting_2016_1.lists.webservices.netsuite.com" xmlns:ns14="urn:sales_2016_1.transactions.webservices.netsuite.com" xmlns:ns15="urn:types.sales_2016_1.transactions.webservices.netsuite.com" xmlns:ns16="urn:purchases_2016_1.transactions.webservices.netsuite.com" xmlns:ns17="urn:customers_2016_1.transactions.webservices.netsuite.com" xmlns:ns18="urn:financial_2016_1.transactions.webservices.netsuite.com" xmlns:ns19="urn:bank_2016_1.transactions.webservices.netsuite.com" xmlns:ns2="urn:messages_2016_1.platform.webservices.netsuite.com" xmlns:ns20="urn:inventory_2016_1.transactions.webservices.netsuite.com" xmlns:ns21="urn:types.inventory_2016_1.transactions.webservices.netsuite.com" xmlns:ns22="urn:general_2016_1.transactions.webservices.netsuite.com" xmlns:ns23="urn:customization_2016_1.setup.webservices.netsuite.com" xmlns:ns24="urn:types.customization_2016_1.setup.webservices.netsuite.com" xmlns:ns25="urn:employees_2016_1.lists.webservices.netsuite.com" xmlns:ns26="urn:types.employees_2016_1.lists.webservices.netsuite.com" xmlns:ns27="urn:filecabinet_2016_1.documents.webservices.netsuite.com" xmlns:ns28="urn:types.filecabinet_2016_1.documents.webservices.netsuite.com" xmlns:ns29="urn:website_2016_1.lists.webservices.netsuite.com" xmlns:ns3="urn:common_2016_1.platform.webservices.netsuite.com" xmlns:ns30="urn:types.website_2016_1.lists.webservices.netsuite.com" xmlns:ns31="urn:employees_2016_1.transactions.webservices.netsuite.com" xmlns:ns32="urn:marketing_2016_1.lists.webservices.netsuite.com" xmlns:ns33="urn:types.marketing_2016_1.lists.webservices.netsuite.com" xmlns:ns34="urn:demandplanning_2016_1.transactions.webservices.netsuite.com" xmlns:ns35="urn:types.demandplanning_2016_1.transactions.webservices.netsuite.com" xmlns:ns36="urn:supplychain_2016_1.lists.webservices.netsuite.com" xmlns:ns37="urn:types.supplychain_2016_1.lists.webservices.netsuite.com" xmlns:ns38="urn:types.core_2016_1.platform.webservices.netsuite.com" xmlns:ns39="urn:types.faults_2016_1.platform.webservices.netsuite.com" xmlns:ns4="urn:scheduling_2016_1.activities.webservices.netsuite.com" xmlns:ns40="urn:types.common_2016_1.platform.webservices.netsuite.com" xmlns:ns41="urn:types.purchases_2016_1.transactions.webservices.netsuite.com" xmlns:ns42="urn:types.customers_2016_1.transactions.webservices.netsuite.com" xmlns:ns43="urn:types.financial_2016_1.transactions.webservices.netsuite.com" xmlns:ns44="urn:types.bank_2016_1.transactions.webservices.netsuite.com" xmlns:ns45="urn:types.employees_2016_1.transactions.webservices.netsuite.com" xmlns:ns5="urn:types.scheduling_2016_1.activities.webservices.netsuite.com" xmlns:ns6="urn:communication_2016_1.general.webservices.netsuite.com" xmlns:ns7="urn:types.communication_2016_1.general.webservices.netsuite.com" xmlns:ns8="urn:relationships_2016_1.lists.webservices.netsuite.com" xmlns:ns9="urn:types.relationships_2016_1.lists.webservices.netsuite.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap-env:Header> <ns2:applicationInfo/> </soap-env:Header> <soap-env:Body> <ns2:login> <ns2:passport> <ns0:email>obviously@fake.email</ns0:email> <ns0:password>password</ns0:password> <ns0:account>123456</ns0:account> <ns0:role internalId="1111" {0}/> </ns2:passport> </ns2:login> </soap-env:Body> </soap-env:Envelope>""".format(attrs) r=requests.post("https://webservices.netsuite.com/services/NetSuitePort_2016_1", headers=headers, data=payload, verify=False) print(r.text)
Thanks for the detailed bug report 👍
I've just committed a number of changes which should fix this issue, let me know if you keep running into any issues
I am using zeep 0.7.0.dev0. The following
gives this error:
My understanding is that service does not expect the passed attributes with None values:
If you directly post the payload without these attributes, it gives correct response about invalid credentials: