suds.WebFault:服务器引发的错误:' org.xml.sax.SAXException:无效的类型:employees'

时间:2017-09-21 12:08:56

标签: python wsdl netsuite suds

我是netsuite的新手,我必须将我的当前应用程序整合到netsuite中。我编写了以下代码来登录到netsuite沙箱环境并在数据库中创建一个新的数据条目。

from suds.client import Client
import os, time, sys, datetime
import suds
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

reload(sys)
sys.setdefaultencoding('utf8')

NS_HOST = 'https://webservices.sandbox.netsuite.com'
email ='utkarsh.sharma@ABCD.com'
pwd   ='ABCDEFGHI!'
account = "3828138"
NS_ENDPOINT = "2017_1"
NS_ROLE = 25

wsdl = 'https://webservices.sandbox.netsuite.com/wsdl/v2017_1_0/netsuite.wsdl'

client = Client(url=wsdl)
ApplicationInfo = client.factory.create('ns16:ApplicationInfo')
ApplicationInfo.applicationId = "A8C51D62-63FC-42DC-AE13-B1B971F41C47"

client.set_options(location= NS_HOST + "/services/NetSuitePort_" + 
NS_ENDPOINT, soapheaders={'applicationInfo':ApplicationInfo})

passport = client.factory.create('ns4:Passport')
passport.email = email
passport.password = pwd
passport.account = account

loginResponse = client.service.login(passport,_soapheaders=
{'applicationInfo': ApplicationInfo})


print('Login Response: ')
print (loginResponse.status)

recordRef = client.factory.create('ns4:RecordRef')
recordRef._internalId = 123456789
recordRef._type = 'employees'
record = client.service.get(recordRef)
print (record)

我可以登录,但在尝试发布数据时,我遇到以下错误。

suds.WebFault: Server raised fault: 'org.xml.sax.SAXException: Invalid type: employees'

欢迎任何形式的帮助。提前谢谢。

1 个答案:

答案 0 :(得分:0)

记录类型应该是单数。尝试设置df_1 = df.query("IntakeDate=='3-Jul-52' & Quantity=='WB'")['Converge'] ,而不是'员工'。记录类型通常是单数版本,例如print (df_1) 0 T Name: Converge, dtype: object recordRef.type = 'employee'invoicesalesorder