Flutter SOAP: How to using SOAP in Flutter?


How to using SOAP Api calls in Flutter? I have tried rest calls is working fine. I need to build SOAP calls in flutter. Kindly share how to call SOAP in flutter


refer this link sucessfully call SOAP https://dartpad.dartlang.org/2561dd3579e45d1eb730

void functionCall() async {
    var envelope = '''
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <GetAllCity xmlns="http://tempuri.org/" />

    http.Response response = await http.post(
        headers: {
          "Content-Type": "text/xml; charset=utf-8",
          "SOAPAction": "http://tempuri.org/GetAllCity",
          "Host": "www.i2isoftwares.com"
          //"Accept": "text/xml"
        body: envelope);

    var rawXmlResponse = response.body;

// Use the xml package's 'parse' method to parse the response.
    xml.XmlDocument parsedXml = xml.parse(rawXmlResponse);

    print("DATAResult=" + response.body);

Answered By – lemuriyan

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.