1

I have a client code which is written using ZSI i would like to setup a mock with static response. I tried to use urllib2 package but its not working as the return type is string in urllib2 and here the response is of another type which i dont know. help me... can any one help me in this?

Code:

from PayDayLoans_services_types import *
import urlparse, types
from ZSI.TCcompound import ComplexType, Struct
from ZSI import client
import ZSI

# Locator
class PayDayLoansLocator:
    PayDayLoansSoap_address = "https://something.com/something.asmx"
    def getPayDayLoansSoapAddress(self):
        return PayDayLoansLocator.PayDayLoansSoap_address
    def getPayDayLoansSoap(self, url=None, **kw):
        return PayDayLoansSoapSOAP(url or PayDayLoansLocator.PayDayLoansSoap_address, **kw)

# Methods
class PayDayLoansSoapSOAP:
    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: LoanResubmitXML
    def LoanResubmitXML(self, request):
        if isinstance(request, LoanResubmitXMLSoapIn) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        kw = {}
        # no input wsaction
        self.binding.Send(None, None, request, soapaction="http://www.something.com/Request/ResubmitXML", **kw)
        # no output wsaction
        response = self.binding.Receive(LoanResubmitXMLSoapOut.typecode)
        return response
falsetru
  • 357,413
  • 63
  • 732
  • 636

0 Answers0