55 {
56
57
58
59 std::vector<std::string> document_uids;
60 document_uids.reserve(s.documents.size());
61 for (const auto& d : s.documents) {
62 document_uids.push_back(d.unique_id);
63 }
64
66 audit(s, document_uids, r);
67 return r;
68 };
69
70 std::vector<std::string> cids;
71 cids.reserve(s.documents.size());
72 for (std::size_t i = 0; i < s.documents.size(); ++i) {
73 cids.push_back(make_cid(i));
74 }
75
77 if (env_result.is_err()) {
78 return do_audit(kcenon::common::make_error<submit_response>(
79 env_result.error()));
80 }
81 auto env = env_result.value();
82
86 if (sign_result.is_err()) {
87 return do_audit(kcenon::common::make_error<submit_response>(
88 sign_result.error()));
89 }
90
91 std::vector<detail::mtom_part> parts;
92 parts.reserve(s.documents.size());
93 for (std::size_t i = 0; i < s.documents.size(); ++i) {
94 detail::mtom_part p;
95 p.content_id = cids[i];
96 p.mime_type = s.documents[i].mime_type;
97 p.content = s.documents[i].content;
98 parts.push_back(std::move(p));
99 }
100
102 if (mtom_result.is_err()) {
103 return do_audit(kcenon::common::make_error<submit_response>(
104 mtom_result.error()));
105 }
106 auto mtom = mtom_result.value();
107
108 auto http_result =
110 if (http_result.is_err()) {
111 return do_audit(kcenon::common::make_error<submit_response>(
112 http_result.error()));
113 }
114 auto response = http_result.value();
115
117 s.submission_set_unique_id));
118 }
kcenon::common::Result< submit_response > parse_registry_response(const std::string &body, const std::string &submission_set_uid)
void audit(const submission_set &s, const std::vector< std::string > &document_uids, const kcenon::common::Result< submit_response > &r)
kcenon::common::Result< packaged_mtom > package_mtom(const std::string &envelope_xml, const std::vector< mtom_part > &parts)
Assemble a multipart/related MTOM body.
kcenon::common::Result< http_response > http_post(const http_options &opts, const std::string &content_type, const std::string &body)
POST body to opts.endpoint with the given Content-Type.
kcenon::common::Result< bool > sign_envelope(built_envelope &env, std::string_view cert_pem, std::string_view key_pem, std::string_view key_password)
Sign the body + timestamp of env in place.
kcenon::common::Result< built_envelope > build_iti41_envelope(const submission_set &s, const std::vector< std::string > &cid_refs)
Build a SOAP envelope for ITI-41 from submission metadata and a list of content-id references for MTO...
std::string private_key_password
std::string certificate_pem
std::string private_key_pem