def Buy(serv, sa, epname): import copy serv = serv._sa (sa % {'methodname':'Buy'}) billTo_d = {"name":"Buyer One", "address":"1 1st Street", "city":"New York", "state":"NY", "zipCode":"10000"} shipTo_d = {"name":"Buyer One ", "address":"1 1st Street ", "city":"New York ", "state":"NY ", "zipCode":"10000 "} for k,v in shipTo_d.items(): shipTo_d[k] = v[:-1] itemd1 = SOAP.structType( {"name":"widg1","quantity":200,"price":SOAP.decimalType(45.99), "_typename":"LineItem"}) itemd2 = SOAP.structType( {"name":"widg2","quantity":400,"price":SOAP.decimalType(33.45), "_typename":"LineItem"}) items_d = SOAP.arrayType( [itemd1, itemd2] ) items_d._ns = "http://www.soapinterop.org/Bid" po_d = SOAP.structType( data = {"poID":"myord","createDate":SOAP.dateTimeType(),"shipTo":shipTo_d, "billTo":billTo_d, "items":items_d}) try: # it's called PO by MST (MS SOAP Toolkit), JHawk (.NET Remoting), # Idoox WASP, Paul (SOAP::Lite), PranishK (ATL), GLUE, Aumsoft, # HP, EasySoap, and Jake (Frontier). [Actzero accepts either] return serv.Buy(PO=po_d) except: # called PurchaseOrder by KeithBa return serv.Buy(PurchaseOrder=po_d)
def Buy(serv, sa, epname): import copy serv = serv._sa(sa % {'methodname': 'Buy'}) billTo_d = { "name": "Buyer One", "address": "1 1st Street", "city": "New York", "state": "NY", "zipCode": "10000" } shipTo_d = { "name": "Buyer One ", "address": "1 1st Street ", "city": "New York ", "state": "NY ", "zipCode": "10000 " } for k, v in list(shipTo_d.items()): shipTo_d[k] = v[:-1] itemd1 = SOAP.structType({ "name": "widg1", "quantity": 200, "price": SOAP.decimalType(45.99), "_typename": "LineItem" }) itemd2 = SOAP.structType({ "name": "widg2", "quantity": 400, "price": SOAP.decimalType(33.45), "_typename": "LineItem" }) items_d = SOAP.arrayType([itemd1, itemd2]) items_d._ns = "http://www.soapinterop.org/Bid" po_d = SOAP.structType( data={ "poID": "myord", "createDate": SOAP.dateTimeType(), "shipTo": shipTo_d, "billTo": billTo_d, "items": items_d }) try: # it's called PO by MST (MS SOAP Toolkit), JHawk (.NET Remoting), # Idoox WASP, Paul (SOAP::Lite), PranishK (ATL), GLUE, Aumsoft, # HP, EasySoap, and Jake (Frontier). [Actzero accepts either] return serv.Buy(PO=po_d) except: # called PurchaseOrder by KeithBa return serv.Buy(PurchaseOrder=po_d)