Reputation: 1
I am getting error "Unable to cast object of type 'System.Xml.XmlNode[]' to type 'System.IConvertible'." with the below webservice call (python 3.6/Zeep Client). The issue is that req_opt_doc_item1 & req_opt_doc_item2 could not be evaluated with "Val". Without it the call is successful though I am not able to get the desired results. Both are integer types as per the wsdl. I am thinking it is not do with the data type but req_opt_doc_item1 & req_opt_doc_item2 could not be passed as array with two elements in them.
What am I missing here?
def load_documents(doc_id):
try:
cws_req_doc_info_id = {
'CWS_REQ_DOC_INFO_ID': ['DocTitle', 'DocDelTstamp', 'DocContent'],
}
req_doc_info = {
'DocId': doc_id,
'ReqInfo': cws_req_doc_info_id,
}
req_opt_doc_item1 = {
'Id': 'OutputFormat',
'Val': 3,
}
req_opt_doc_item2 = {
'Id': 'LoadDDocType',
'Val': 0,
}
cws_req_opt_doc_item = {
'CwsReqOptDocItem': [req_opt_doc_item1, req_opt_doc_item2]
}
# Prepare the ReqOptDoc data
req_opt_doc = {
'Options': cws_req_opt_doc_item
}
# Construct the request payload
load_doc_contents = {
'UserCredential': user_credential,
'ReqDocInfo': req_doc_info,
'ReqOptDoc': req_opt_doc
}
# print(load_doc_contents)
response = client.service.LoadDocContents(**load_doc_contents)
return response
except Exception as wsdl_err:
cyp.write_log_file(True, True, email_id, this_script_name, str(wsdl_err) + '\n')
exit(-1)
Called with below
{
"UserCredential":{
"CredentialType":"UserIdPassword",
"DomainName":"XXXXXXX",
"UserName":"XXXXX",
"Password":"XXXXX",
"CypWsUserId":"",
"CredentialData":""
},
"ReqDocInfo":{
"DocId":"13930063 ",
"ReqInfo":{
"CWS_REQ_DOC_INFO_ID":[
"DocTitle",
"DocDelTstamp",
"DocContent"
]
}
},
"ReqOptDoc":{
"Options":{
"CwsReqOptDocItem":[
{
"Id":"OutputFormat",
"Val":3
},
{
"Id":"LoadDDocType",
"Val":0
}
]
}
}
}
Tried to initiate a Webservice call to get the response from the server. The request message is having a cast issue.
Upvotes: 0
Views: 13