20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/et_fake_acas_server/xml_builders/found_xml_builder.rb', line 20
def builder(data)
Nokogiri::XML::Builder.new do |xml|
namespaces = {
'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope',
'xmlns:u' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'
}
xml['s'].Envelope(namespaces) do
xml['s']. do
xml.ActivityId("e67a4d86-e096-4a35-aa3a-2b3a8ffaaa54", 'CorrelationId': '03973d23-3c39-4359-aa69-4d37b922fb60', xmlns: 'http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics')
xml['o'].Security('s:mustUnderstand': '1', 'xmlns:o': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd') do
xml['u'].Timestamp('u:Id': '_0') do
xml['u'].Created '2014-03-03T10:15.01.251Z'
xml['u'].Expires '2014-03-03T10:20:01.251Z'
end
end
end
xml['s'].Body do
xml.GetECCertificateResponse(xmlns: 'https://ec.acas.org.uk/lookup/') do
xml.GetECCertificateResult('xmlns:a': 'http://schemas.datacontract.org/2004/07/Acas.CertificateLookup.EcLookupService', 'xmlns:i': 'http://www.w3.org/2001/XMLSchema-instance') do
xml['a'].Certificate Base64.encode64(aes_encrypt(Base64.encode64(File.read(data.certificate_file))))
xml['a'].ClaimantName Base64.encode64(aes_encrypt(data.claimant_name))
xml['a'].CurrentDateTime Base64.encode64(aes_encrypt(Time.now.strftime('%d/%m/%Y %H:%M:%S')))
xml['a'].DateOfIssue Base64.encode64(aes_encrypt(data.date_of_issue.strftime('%d/%m/%Y %H:%M:%S')))
xml['a'].DateOfReceipt Base64.encode64(aes_encrypt(data.date_of_receipt.strftime('%d/%m/%Y %H:%M:%S')))
xml['a'].ECCertificateNumber Base64.encode64(aes_encrypt(data.certificate_number))
xml['a'].IV Base64.encode64(rsa_encrypt(Base64.encode64(iv)))
xml['a'].Key Base64.encode64(rsa_encrypt(Base64.encode64(key)))
xml['a'].Message Base64.encode64(aes_encrypt(data.message))
xml['a'].MethodOfIssue Base64.encode64(aes_encrypt(data.method_of_issue))
xml['a'].RespondentName Base64.encode64(aes_encrypt(data.respondent_name))
xml['a'].ResponseCode Base64.encode64(aes_encrypt('100'))
xml['a'].ServiceVersion Base64.encode64(aes_encrypt('1.0'))
end
end
end
end
end
end
|