SivaSOAPValidationServiceClient implements ValidationService { static String createXMLValidationRequest(String base64Document, FileType fileType, String filename, String report, String policy) { String documentType = getSoapDocumentTypeRow(fileType); String reportType = getSoapReportTypeRow(report); String policyType = getSoapPolicyTypeRow(policy); String extraLines = documentType + reportType + policyType; return "<soapenv:Envelope xmlns:soapenv=\"http: " <soapenv:Header/>" + LINE_SEPARATOR + " <soapenv:Body>" + LINE_SEPARATOR + " <soap:ValidateDocument>" + LINE_SEPARATOR + " <soap:ValidationRequest>" + LINE_SEPARATOR + " <Document>" + base64Document + "</Document>" + LINE_SEPARATOR + " <Filename>" + filename + "</Filename>" + LINE_SEPARATOR + extraLines + " </soap:ValidationRequest>" + LINE_SEPARATOR + " </soap:ValidateDocument>" + LINE_SEPARATOR + " </soapenv:Body>" + LINE_SEPARATOR + "</soapenv:Envelope>"; }  @Override String validateDocument(String policy, String report, UploadedFile file); @Autowired void setProperties(SivaRESTWebServiceConfigurationProperties properties); @Autowired void setRestTemplate(RestTemplate restTemplate);  }
@Test public void validXmlSoapCreation() { String request = SivaSOAPValidationServiceClient.createXMLValidationRequest("dGVzdA==", FileType.XROAD, "filename.asice", "Simple", "POLv3"); String expectedRequest = "<soapenv:Envelope xmlns:soapenv=\"http: " <soapenv:Header/>" + LINE_SEPARATOR + " <soapenv:Body>" + LINE_SEPARATOR + " <soap:ValidateDocument>" + LINE_SEPARATOR + " <soap:ValidationRequest>" + LINE_SEPARATOR + " <Document>dGVzdA==</Document>" + LINE_SEPARATOR + " <Filename>filename.asice</Filename>" + LINE_SEPARATOR + " <DocumentType>XROAD</DocumentType>" + LINE_SEPARATOR + " <ReportType>Simple</ReportType>" + LINE_SEPARATOR + " <SignaturePolicy>POLv3</SignaturePolicy>" + LINE_SEPARATOR + " </soap:ValidationRequest>" + LINE_SEPARATOR + " </soap:ValidateDocument>" + LINE_SEPARATOR + " </soapenv:Body>" + LINE_SEPARATOR + "</soapenv:Envelope>"; Assert.assertEquals(expectedRequest, request); }