*Background
The user is trying to attach a text document to a soap request but Katalon Studio doesn't support attaching documents to the SOAP request.
*Workaround
There is already planning for this feature from the product team. You can find the attached sample project as a workaround, we recommend reading the README file first in the sample project to follow step-by-step instructions on how to do so.
To get response objects from our custom keyword, you need:
-
Open SoapKeywords file, copy and replace the current method sendSOAPRequestWithAttachments with this scrip
@Keyword
def sendSOAPRequestWithAttachments(RequestObject soapRequest, Map<String, File> attachmentLookup, boolean inlineAttachments) {
def attachments = prepareAttachments(attachmentLookup)
def httpRequest = SoapRequestUtil.buildRequestWithAttachments(soapRequest, attachments, inlineAttachments)
HarLogger harLogger = new HarLogger()
harLogger.initHarFile()
def httpResponse = HttpUtil.sendRequest(httpRequest)
long startTime = System.currentTimeMillis();
ResponseObject responseObject = new SoapClient(RunConfiguration.getProjectDir(), RunConfiguration.getProxyInformation())
.toResponseObject(httpResponse);
long waitingTime = System.currentTimeMillis() - startTime;
responseObject.setWaitingTime(waitingTime);
harLogger.logHarFile(soapRequest, responseObject, RunConfiguration.getReportFolder())
WSResponseManager.getInstance().setCurrentRequest(soapRequest)
return responseObject
}
-
In test case, the return value of the CustomKeywords.'webservice.soap.SoapKeywords.sendSOAPRequestWithAttachments' now is the response object
ResponseObject responseObject = CustomKeywords.'webservice.soap.SoapKeywords.sendSOAPRequestWithAttachments'(requestObject, [ "${avatarCid}": avatarFile ], inlineAttachment)
Comments
0 comments
Please sign in to leave a comment.