Awesome
15 years agoFrequent Contributor
how to grab attachment from response and store in List<>
hi all,
i'm trying to do following and i'm a bit stumped:
1) grab a mime attachment, a .csv file, from the soap response (response attachment below)
2) store the .csv file in a List<>
Thanks in advanced for the help!
----Code so far...-----
log.info testRunner.testCase.getTestStepByName( "runReport_1" ).testStep.testRequest.response.attachments[0].getName();
log.info testRunner.testCase.getTestStepByName( "runReport_1" ).testStep.testRequest.response.attachments[0].getContentType();
log.info testRunner.testCase.getTestStepByName( "runReport_1" ).testStep.testRequest.response.attachments[0].data;
log output:
Fri Nov 19 22:49:14 PST 2010:INFO:report
Fri Nov 19 22:49:14 PST 2010:INFO:application/vnd.ms-excel
Fri Nov 19 22:49:14 PST 2010:INFO:null
--- runReport_1 RESPONSE, MIME ATTACHMENT .CSV ----
...
...
</runReportReturn></ns1:runReportResponse></soapenv:Body></soapenv:Envelope>
------=_Part_26_361028225.1290216136604
Content-Type: application/vnd.ms-excel
Content-Transfer-Encoding: binary
Content-Id: <report>
Replication Session History,,,,,
ORG_ID,SESSION_ID,START_TIME,END_TIME,STATUS,MESSAGES
00DB0000000bozD,1,"Nov 12, 2010","Nov 12, 2010",FAILED,Maximum number of object replication failures encountered.
00DB0000000bozD,2,"Nov 12, 2010","Nov 12, 2010",FAILED,Maximum number of object replication failures encountered.
00DB0000000bozD,3,"Nov 12, 2010","Nov 12, 2010",SUCCESS,
00DB0000000bozD,4,"Nov 12, 2010","Nov 12, 2010",SUCCESS,
,,,,,
------=_Part_26_361028225.1290216136604--
i'm trying to do following and i'm a bit stumped:
1) grab a mime attachment, a .csv file, from the soap response (response attachment below)
2) store the .csv file in a List<>
Thanks in advanced for the help!
----Code so far...-----
log.info testRunner.testCase.getTestStepByName( "runReport_1" ).testStep.testRequest.response.attachments[0].getName();
log.info testRunner.testCase.getTestStepByName( "runReport_1" ).testStep.testRequest.response.attachments[0].getContentType();
log.info testRunner.testCase.getTestStepByName( "runReport_1" ).testStep.testRequest.response.attachments[0].data;
log output:
Fri Nov 19 22:49:14 PST 2010:INFO:report
Fri Nov 19 22:49:14 PST 2010:INFO:application/vnd.ms-excel
Fri Nov 19 22:49:14 PST 2010:INFO:null
--- runReport_1 RESPONSE, MIME ATTACHMENT .CSV ----
...
...
</runReportReturn></ns1:runReportResponse></soapenv:Body></soapenv:Envelope>
------=_Part_26_361028225.1290216136604
Content-Type: application/vnd.ms-excel
Content-Transfer-Encoding: binary
Content-Id: <report>
Replication Session History,,,,,
ORG_ID,SESSION_ID,START_TIME,END_TIME,STATUS,MESSAGES
00DB0000000bozD,1,"Nov 12, 2010","Nov 12, 2010",FAILED,Maximum number of object replication failures encountered.
00DB0000000bozD,2,"Nov 12, 2010","Nov 12, 2010",FAILED,Maximum number of object replication failures encountered.
00DB0000000bozD,3,"Nov 12, 2010","Nov 12, 2010",SUCCESS,
00DB0000000bozD,4,"Nov 12, 2010","Nov 12, 2010",SUCCESS,
,,,,,
------=_Part_26_361028225.1290216136604--