#!/usr/bin/env python

################################################## 
# CDPBilling_serviceagent_services.py 
# generated by ZSI.generate.wsdl2python
##################################################

from CDPBilling_serviceagent_services_types import *
import urlparse
import types
from ZSI.TCcompound import ComplexType, Struct
from ZSI import client
import ZSI

#----- Locator -----------------------------------------------------------------

class CDPBilling_serviceagentLocator:
    # Also known as the 'End Point'!
    # CDPBilling_address = "http://test403a.auspost.com.au:80/Services/CDPBilling"
    # CDPBilling_address = "http://hx418:10000/Services/CDPBilling"  # IST Environment
    CDPBilling_address = "http://hx422:10000/Services/CDPBilling"  # SVT Environment

    def getCDPBillingAddress(self):
        return CDPBilling_serviceagentLocator.CDPBilling_address

    def getCDPBilling(self, url=None, **kw):
        return CDPBillingHTTP11BindingSOAP(url or CDPBilling_serviceagentLocator.CDPBilling_address, **kw)

#----- Methods -----------------------------------------------------------------

class CDPBillingHTTP11BindingSOAP:
    def __init__(self, url, **kw):
        kw.setdefault("readerclass", None)
        kw.setdefault("writerclass", None)
        # no resource properties
        self.binding = client.Binding(url=url, **kw)
        # no ws-addressing

    #----- op: receiveCDPBilling -----------------------------------------------

    def receiveCDPBilling(self, request, soapheaders=(), **kw):
        if isinstance(request, ReceiveCDPBilling) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        # kw = {}
        # no input wsaction
        self.binding.Send(None, None, request, soapaction="/Services/CDPBilling/receiveCDPBilling", soapheaders=soapheaders, **kw)
        # no output wsaction
        response = self.binding.Receive(CDPBillingResponse.typecode)
        self.soapheaders = self.binding.ps.ParseHeaderElements([GED(u'http://www.auspost.com.au/ESB/schema/ESBTypes', u'ESBSvcHeader'),])
        return response

#-------------------------------------------------------------------------------

ESBSvcHeader       = ns1.ESBSvcHeader_Dec().pyclass
ReceiveCDPBilling  = ns0.CDPBilling_Dec().pyclass
CDPBillingResponse = ns0.BillingResponse_Dec().pyclass
BillingResponse    = ns0.BillingResponse_Dec().pyclass

