Search code examples
pythonweb-serviceswsdlzeep

How to get multi-page SOAP response with Zeep?


I'm making a SOAP call to a web service that returns a paginated response. Zeep is the only Python library I've found that even works for this web service.

When I make the call, it returns the first 100 records (1 page) of results. How do I either call again for the next page (repeat until done), or specify that I want all of the pages?


Solution

  • Create a dict with the request criteria. Grab the first page of results, parse the request for the total number of pages, and setup a loop.

    In the case of Workday:

    request_crit = {'Response_Filter' : { 
                    'Page' : 1,
                    'Count' : number_results,
                    'As_Of_Entry_DateTime' : your timestamp,
    }}
    
    response = service.get_schools(request_crit)
    #process the response
    request_crit=['Response_Filter']['Page'] +=