我正在测试 Web 服务 atm,并且正在以 Base64 格式提取文件。
我已经设法隐藏文件并将它们保存到一个位置。
但是我希望直接打开文件,我正在处理 PDF 文件和图像,所以我认为浏览器是打开文件的最佳选择。
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
import org.apache.commons.codec.binary.Base64;
Base64 coder = new Base64();
def filename = context.expand( '${DWG_OphalenBijlage (1)#Response#declare namespace b=\'http://schemas.datacontract.org/2004/07/Dynamics.Ax.Application\'; declare namespace ns1=\'http://www.XXXXXX.be/neptunus/moka/soconsult/getattachment\'; //ns1:MoKaGetAttachmentGetAttachmentResponse[1]/ns1:response[1]/b:MoKaSOAttachment[1]/b:FileType[1]}' )
def encodedString = context.expand( '${DWG_OphalenBijlage (1)#Response#declare namespace b=\'http://schemas.datacontract.org/2004/07/Dynamics.Ax.Application\'; declare namespace ns1=\'http://www.XXXXXXX.be/neptunus/moka/soconsult/getattachment\'; //ns1:MoKaGetAttachmentGetAttachmentResponse[1]/ns1:response[1]/b:MoKaSOAttachment[1]/b:DataFile[1]}' )
def decoded = encodedString.decodeBase64();
def f = new File(groovyUtils.projectPath + '/Bijlage1.' + filename);
f.delete();
f << decoded
log.info(groovyUtils.projectPath + '/Bijlage1.' + filename);
这保存了图像现在可以 annybody 建议我下一步应该做什么来自动打开文件?