2.16WebService Interface Requests (SOAP)

Created on Aug 17, 2026~3 min read

WebService is an application based on SOA (Service-Oriented Architecture) that is language- and platform-independent. It implements cross-language interoperation through XML descriptions and uses the HTTP protocol to interact between network applications on the Internet. The framework supports requests to WebService interfaces; the following is example code:

SOAP 1.1

cs
var result = await httpRemoteService.PostAsStringAsync("http://your-host-address/Share/DatabaseManager.asmx",    builder => builder.SetSOAPAction("http://tempuri.org/GetDatabaseList")  // Can optionally auto-append double quotes: addQuotes: true        .SetXmlContent("""                        <?xml version="1.0" encoding="utf-8"?>                        <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">                            <soap:Header>                            <Erp7SoapHeader xmlns="http://tempuri.org/">                                <ID></ID>                            </Erp7SoapHeader>                            </soap:Header>                            <soap:Body>                            <GetDatabaseList xmlns="http://tempuri.org/" />                            </soap:Body>                        </soap:Envelope>                        """, Encoding.UTF8));

SOAP 1.2

cs
var result = await httpRemoteService.PostAsStringAsync("http://your-host-address/Share/DatabaseManager.asmx",    builder => builder.SetXmlContent("""                                        <?xml version="1.0" encoding="utf-8"?>                                        <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">                                        <soap12:Header>                                            <Erp7SoapHeader xmlns="http://tempuri.org/">                                            <ID></ID>                                            </Erp7SoapHeader>                                        </soap12:Header>                                        <soap12:Body>                                            <GetDatabaseList xmlns="http://tempuri.org/" />                                        </soap12:Body>                                        </soap12:Envelope>                                        """, Encoding.UTF8, "application/soap+xml"));

In some XML returned by WebService interfaces, the soap:Body node may be Base64-encoded and GZip-compressed. In this case, you can decode and decompress it with the following code:

cs
// Parse the XML using XDocumentvar xDocument = XDocument.Parse(result!);// SOAP 1.1var bodyContent = xDocument.Descendants(XName.Get("Body", "http://schemas.xmlsoap.org/soap/envelope/")).FirstOrDefault()?.Value!;// SOAP 1.2// var bodyContent = xDocument.Descendants(XName.Get("Body", "http://www.w3.org/2003/05/soap-envelope")).FirstOrDefault()?.Value!;// Base64 decodevar data = Convert.FromBase64String(bodyContent);// GZip decompressionusing var input = new MemoryStream(data);await using var gzip = new GZipStream(input, CompressionMode.Decompress);using var output = new MemoryStream();await gzip.CopyToAsync(output);// Get the actual contentvar body = Encoding.UTF8.GetString(output.ToArray());