0

I have a very simple SOAP request that I'm sending to a server.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:RetrieveDocRequest>
         <F_FOLDER>folderName</F_FOLDER>
         <F_USER>userName</F_USER>
         <F_PASSWORD>psw</F_PASSWORD>
         <F_DOC_ID>111222333</F_DOC_ID>
      </web:RetrieveDocRequest>
   </soapenv:Body>
</soapenv:Envelope>

The response I expect is a file that is around 35 MB. Instead what I receive looks something like the following.

Transfer-Encoding   chunked
#status#    HTTP/1.1 200 OK
Content-Language    en-US
Date    Fri, 11 Dec 2018 19:45:17 GMT
X-Powered-By    Servlet/3.0
Content-Type    text/xml; charset=UTF-8

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <a:RetrieveCompanyResponse xmlns:a="http://somewebservice.company.morecompany.com/">
            <documentStream>AF3xQEBAQEBAQEBAQEBA...</documentStream>
        <a:RetrieveCompanyResponse>
    </soap:Body>
</soap:Envelope>

When I parse the documentStream and write it to a file, using python, I notice the file is about 350 KB, which means I'm still missing about 99% of the file.

Is there anything I can do to the SOAP request to allow me to download the entire file, or constantly send me multiple documentStream that I can write to a temporary file?

Also, is there anything I'm particularly doing wrong, such as not sending certain headers over?

EDIT: Python sample code

from zeep import Client
import codecs

wsdl = "http://webservice/service/ServicesPort?wsdl"
f = open('tmpFile.txt', 'wb')

client = Client(wsdl)

result = client.service.RetrieveDoc(
    'folderName',
    'userName',
    'psw',
    '111222333'
)

print len(result) # Ends up being around 240,394
tmpTxt = codecs.decode(result, 'cp500')
tmpTxt = tmpTxt.encode('utf-8')
txtArr = tmpTxt.split('\x00')
# Writes about 350 KB worth of data
for line in txtArr:
    f.write(line)
ThatsANo
  • 56
  • 5
  • 1
    So what is the size of the SOAP response? If that is 35 MB then you might want to add your python code and add the python tag to your question as the problem would be there. If the response is 35 KB, then the issue is at the Server end, so we would need to know about what is executing there. – Dijkgraaf Jan 14 '19 at 22:43
  • I can download the file through other means, which is why I know it is 35 MB. Unfortunately the SOAP response does not contain a Content-Length/size of response. It might be because it came with the Transfer-Encoding chunked. I'll add the python code to see if it helps. – ThatsANo Jan 14 '19 at 22:50
  • Are you doing this in [tag:soapui]? If not, please remove the tag. – SiKing Jan 14 '19 at 23:14
  • I am using soapui to test the XML and then deploying it in python. – ThatsANo Jan 14 '19 at 23:24

0 Answers0