Пример #1
0
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) 
Пример #2
0
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)
Пример #3
0
def testEchoDate (server, action, harsh):
    test = time.gmtime (time.time ())
    server = server._sa (action % {'methodname': 'echoDate'})
    if SOAP.Config.namespaceStyle == '1999':
        result = server.echoDate (inputDate = SOAP.timeInstantType (test))
    else:
        result = server.echoDate (inputDate = SOAP.dateTimeType (test))

    if not SOAP.Config.typed and type (result) in (type (''), type (u'')):
        p = SOAP.SOAPParser()
        result = p.convertDateTime(result, 'timeInstant')

    if result != test[:6]:
        raise Exception, "expected %s, got %s" % (repr (test), repr (result))
Пример #4
0
#!/usr/bin/env python

import time
from SOAPpy import SOAP

srv = SOAP.SOAPProxy('http://localhost:10080/')

for p in ('good param', 'ok param'):
    ret = srv.badparam(p)
    if isinstance(ret, SOAP.faultType):
        print ret
    else:
        print 'ok'

dt = SOAP.dateTimeType(time.localtime(time.time()))
print srv.dt(dt)



Пример #5
0
def manyTypesTest(num, bool, state, doub, dat, bin):
    return [
        num,
        SOAP.booleanType(bool), state, doub,
        SOAP.dateTimeType(dat), bin
    ]
Пример #6
0
def echoDate(inputDate):
    return SOAP.dateTimeType(inputDate)
Пример #7
0
def manyTypesTest (num, bool, state, doub, dat, bin):
    return [num, SOAP.booleanType (bool), state, doub,
        SOAP.dateTimeType (dat), bin]
Пример #8
0
def echoDate(inputDate):
    return SOAP.dateTimeType(inputDate)