oop - Python suds attirbuteError: Fault instance has no attribute 'detail' -
howdie do,
i've created package class sets default values such shipper, consignee, packages , commodities.
the issue when go call method shippackage suds client, receive error:
attributeerror: fault instance has no attribute 'detail'
the first file listed below test file sets necessary dictionaries:
import ship # create new package object package1 = ship.package('tx') # set consignee package1.setconsignee('dubs enterprise', 'jw', '2175 14th street', 'troy', 'ny', '12180', 'usa') # set default packaging package1.setdefaults('custom', '12/12/15', 'oktoleave') # add commodity description each package package1.addpackage('12.3 lbs', '124.00') package1.addcommodity('this package number 1', '23.5 lbs') # add commodity list defaults dictionary package1.setcommoditylist() # add package list packages dictionary package1.setpackagelist() package1.shippackage()
the module being imported following:
from suds.client import client suds.bindings import binding binding.envns = ('soap-env', 'http://www.w3.org/2003/05/soap-envelope') client = client('http://localhost/progisticsamp/amp.svc/wsdl', headers={'content-type': 'application/soap+xml'}, faults=false) class package(object): def __init__(self, shipper): self.commoditylist = [] self.commoditycontents = {} self.consignee = {} self.defaults = {} self.packagelist = [] self.packages = {} self.defaults['shipper'] = shipper def setconsignee(self, company, contact, address, city, state, zip, country): self.consignee['company'] = company self.consignee['contact'] = contact self.consignee['address1'] = address self.consignee['city'] = city self.consignee['stateprovince'] = state self.consignee['postalcode'] = zip self.consignee['countrysymbol'] = country self.defaults['consignee'] = self.consignee def setdefaults(self, packaging, shipdate, deliverymethod): self.defaults['packaging'] = packaging self.defaults['shipdate'] = shipdate self.defaults['deliverymethod'] = deliverymethod def addcommodity(self, description, unitweight): commodity = {} commodity['description'] = description commodity['unitweight'] = {'value': unitweight} self.commoditylist.append(commodity) def addpackage(self, weight, declarevalue): package = {} package['weight'] = {'value': weight} package['declaredvalueamount'] = {'amount': declarevalue, 'currency': 'usd'} self.packagelist.append(package) def setcommoditylist(self): self.commoditycontents = {'item': self.commoditylist} self.defaults['commoditycontents'] = self.commoditycontents def setpackagelist(self): self.packages = {'item': self.packagelist} def shippackage(self): print self.defaults print self.packages # print client response = client.service.ship('connectship_ups.ups.gnd', self.defaults, self.packages, true, 'release') result = response.result print result
within shippackage method, print self.packages , self.defaults , confirm have data within them before call
client.service.ship()
so know have values within before call client.service.ship()
am missing here? why won't take defaults , packages dictionary i've set?
the issue value 'shipdate'
the wsdl expecting shipdate in different format.
the way able find switching endpoint soap 1.2 1.1
which did directly editing web.config file
this 100% working
Comments
Post a Comment