Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 3

ValueError: The Decimal type doesn't accept collections as value

Solved! Go to Solution.

Hi,

 

I am trying to invoke WSDL to update tracking number for a shipment line in oracle fusion cloud : {http://xmlns.oracle.com/apps/scm/shipping/shipConfirm/deliveries/shipmentLineService/}ShipmentLineSe... wsdl via python using zeep. Below is the payload that successfully executes in SOAP UI and returns a response. When I invoke the wsdl via python it throws ValueError: The Decimal type doesn't accept collections as value. Please advice.

 

SOAP Payload:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/scm/shipping/shipConfirm/deliveries/shipmentLineService/types/" xmlns:ship="http://xmlns.oracle.com/apps/scm/shipping/shipConfirm/deliveries/shipmentLineService/">
<soapenv:Header/>
<soapenv:Body>
<typ:UpdateShipmentLines>
<typ:apiVersionNumber>1.0</typ:apiVersionNumber>
<typ:InitMsgList>T</typ:InitMsgList>

<typ:ShipmentLineInformation>
<ship:ShipmentLine>619092</ship:ShipmentLine>
<ship:TrackingNumber>67481420011234</ship:TrackingNumber>
</typ:ShipmentLineInformation>
</typ:UpdateShipmentLines>
</soapenv:Body>
</soapenv:Envelope>

 

Python Code:

import os
import pprint
import requests
import time
import zeep
import sys
import csv

client = None
username = 'xxxx'
password = 'abcd'
wsdl = 'https://<host>/fscmService/ShipmentLineService?WSDL'
filename = sys.argv[1] #This is the input file with 2 columns, 1 for shipmentline and 1 for the tracking number

def get_client_session(username, password):
session = requests.Session()
session.auth = requests.auth.HTTPBasicAuth(username, password)
transport = zeep.transports.Transport(session=session, timeout=30)
client = zeep.Client(wsdl=wsdl, transport=transport)

return client

with open(filename) as csv_file:

parsed_csv = csv.reader(csv_file, delimiter='\t')

for row in parsed_csv:
if (row[0] == "ShipmentLineId"):
print("Skipped header row")
print("=" * 100)
else:
shipline = row[0]
trknum = row[1]
shiplineinfo = {
'ShipmentLine':shipline,
'TrackingNumber':trknum
}

 

trackinfo = {
'apiVersionNumber': 1.0,
'InitMsgList': 'T',
'ShipmentLineInformation': shiplineinfo
}

print(trackinfo)
client = get_client_session(username, password)
try:
response = client.service.UpdateShipmentLines(trackinfo)
print("Successful update on ShipmentLine #" + row[0] + " track #" + row[1])
print("Here's the response:")
print(response)
print("=" * 100)
except zeep.exceptions.Fault as error:
print("Failed update on ShipmentLine #" + row[0] + " track #" + row[1])
print(error)
print("*" * 100)

 

Error Msg:

$ python updateTrackingNumber.py ShipInfo.tsv
Skipped header row
====================================================================================================
{'ShipmentLineInformation': {'TrackingNumber': '850683456', 'ShipmentLine': '585068'}, 'InitMsgList': 'T', 'apiVersionNumber': 1.0}
Traceback (most recent call last):
File "updateTrackingNumber.py", line 49, in <module>
response = client.service.UpdateShipmentLines(trackinfo)
File "/home/system/.local/lib/python2.7/site-packages/zeep/proxy.py", line 42, in __call__
self._op_name, args, kwargs)
File "/home/system/.local/lib/python2.7/site-packages/zeep/wsdl/bindings/soap.py", line 121, in send
options=options)
File "/home/system/.local/lib/python2.7/site-packages/zeep/wsdl/bindings/soap.py", line 68, in _create
serialized = operation_obj.create(*args, **kwargs)
File "/home/system/.local/lib/python2.7/site-packages/zeep/wsdl/definitions.py", line 200, in create
return self.input.serialize(*args, **kwargs)
File "/home/system/.local/lib/python2.7/site-packages/zeep/wsdl/messages/soap.py", line 78, in serialize
self.body.render(body, body_value)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/elements/element.py", line 203, in render
self._render_value_item(parent, value, render_path)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/elements/element.py", line 227, in _render_value_item
return self.type.render(node, value, None, render_path)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/types/complex.py", line 253, in render
element.render(parent, element_value, child_path)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/elements/indicators.py", line 241, in render
element.render(parent, element_value, child_path)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/elements/element.py", line 203, in render
self._render_value_item(parent, value, render_path)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/elements/element.py", line 227, in _render_value_item
return self.type.render(node, value, None, render_path)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/types/simple.py", line 74, in render
parent.text = self.xmlvalue(value)
File "/home/system/.local/lib/python2.7/site-packages/zeep/xsd/types/builtins.py", line 30, in _wrapper
self.__class__.__name__))
ValueError: The Decimal type doesn't accept collections as value

2 Replies
Pilot Lvl 1
Message 2 of 3

Re: ValueError: The Decimal type doesn't accept collections as value

Thanks for your improvement,but that questions are a bit confused. (1)Oracle.com(2)w3.com- this are two different text protocols.It could be better to concentrate on neighboring site whether they support the issuing on developers retrieve. Github associated sites have got retrieve gateway that will directly launch you to the position of that content,this action are found in any new website page. It will be difficult to handle non associated content that is from independent sites.so if developer is not included among the share option, may they have away of repairing their projects. Otherwise thanks for your struggling keep it up👍
Thanks....
Solution
Copilot Lvl 2
Message 3 of 3

Re: ValueError: The Decimal type doesn't accept collections as value

This issue can be closed. Once I passed the parameters as a named value pair within the service method, the error went away and the service executed successfully.

 

response = client.service.UpdateShipmentLines(apiVersionNumber=1.0,InitMsgList='T',ShipmentLineInformation=shiplineinfo)

 

This solved the problem.

 

Thanks!