[BACK-GOV-03] SOAP Network Server Implementation and XML Request/Response Modeling

Backend: Architecture

Published

October 14, 2026

NoteTask Brief
  • Repository / Component: gov_identity_soap_mock.
  • Language: Go (1.27+).
  • Task Type: Backend (Stack Components).
  • Status: Ready for Implementation

Task Description

It is necessary to spin up an HTTP server listening on port :8000 and design strongly-typed structures (data types) to parse incoming and construct outgoing enterprise-level messages in the SOAP/XML format.

Step-by-Step Instructions

  1. Modeling the Incoming SOAP Envelope: Based on the standard namespace http://xmlsoap.org, define the SoapEnvelopeRequest structure and its nested Body object for the fetch_secure_employee_data method, which accepts email and master_token fields.
  2. Modeling the Outgoing Response: Design the SoapEnvelopeResponse XML structure supporting both soapenv and gov namespace attributes. The employee profile fields (inn, passport, snils, gov_status) must include the omitempty tag so they are omitted from the XML serialization in case of errors.
  3. HTTP Server Initialization: In the main() function, configure the standard http.HandleFunc router mapping to the root path / and start listening on the port using http.ListenAndServe(":8000", nil).
  4. Response Transmission Helper: Implement a helper function sendSoapResponse that handles marshaling the response structure with indentation via xml.MarshalIndent, sets the Content-Type: text/xml; charset=utf-8 header, and explicitly writes the xml.Header to the HTTP response body.