简体   繁体   English

Flutter - 带有 xml 主体的 POST 请求

[英]Flutter - POST request with an xml body

I'm trying to do a POST request on an API with Flutter.我正在尝试使用 Flutter 对 API 执行 POST 请求。 I have tried with xml and xml_parser library but I didn't resolve it.我已经尝试过使用 xml 和 xml_parser 库,但我没有解决它。 I have tried the request with Postman and it works.我已经用 Postman 尝试了这个请求,它可以工作。

The xml document that I have to send is something like this:我必须发送的 xml 文档是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<p:serviceRequest xmlns:p="http://..." xmlns:xsi="http://..." xsi:schemaLocation="http://... api.xsd">
<info1>...</info1>
      ....
<infoN>...</infoN>
</p:serviceRequest>

How can I send this document with my base URL?如何使用我的基础 URL 发送此文档?

Thanks.谢谢。

Resolved:解决:

I didn't add the header in the POST call specifing the content-type as application/xml我没有在将内容类型指定为 application/xml 的 POST 调用中添加 header

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM