【问题标题】:Flutter SOAP: How to using SOAP in Flutter?Flutter SOAP:如何在 Flutter 中使用 SOAP?
【发布时间】:2019-03-16 02:06:40
【问题描述】:

如何在 Flutter 中使用 SOAP Api 调用?我试过休息电话工作正常。我需要在颤振中构建 SOAP 调用。请分享如何在 Flutter 中调用 SOAP

【问题讨论】:

  • 似乎还没有完整的解决方案。好消息是您仍然可以自己进行 SOAP 调用。在 cmets 中,您可能会看到一些示例如何做到这一点 - stackoverflow.com/a/35157186/1010710

标签: dart flutter dart-pub


【解决方案1】:

参考此链接成功调用 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"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetAllCity xmlns="http://tempuri.org/" />
  </soap:Body>
</soap:Envelope>
''';

    http.Response response = await http.post(
        'http://www.i2isoftwares.com/SSKSService/sskss.asmx',
        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);
  }

【讨论】:

  • 我尝试使用用户代码但没有成功。我有类似的项目,我无法构建信封,因为它非常复杂。我有 wsdl 文档和 xmlspy 帮助,我得到了我需要工作的 xml 部分。但它看起来不像你的例子,任何帮助
猜你喜欢
  • 2020-09-09
  • 2019-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多