好的,我有一个REST API,可以使用带有multipart / form-data格式的HTTP POST请求上传数据。
我尝试在Postman App / Curl中测试和构建请求。当我通过app附加xml文件时,一切正常 - 我有200个代码和有效的响应。
但是当我用raw body查询构建相同的请求时,我从服务器得到500错误,似乎无法从请求中读取文件。
POST /223/integration/integration/upload HTTP/1.1
Host: 127.0.0.1:223
Connection: Keep-Alive
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryp7MA4YWxkTrZu0gW
----WebKitFormBoundaryp7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="login"
mylogin
----WebKitFormBoundaryp7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="password"
mypassword
----WebKitFormBoundaryp7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="document"; filename="purchaseNotice.xml"
Content-Type: text/xml
<?xml version="1.0" encoding="UTF-8"?> <purchaseProtocolPAAE xmlns="http://zakupki.gov.ru/223fz/purchase/1" xmlns:t="http://zakupki.gov.ru/223fz/types/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://zakupki.gov.ru/223/integration/schema/TFF-2.0/purchase.xsd"> <t:header><t:guid>06adddd4-c7cc-4a5f-a667-7dd3f311bec9</t:guid><t:createDateTime>2013-12-19T16:43:51</t:createDateTime></t:header> <body><item><t:guid>a99d3960-2be6-4baf-aae6-69a4074bd0ec</t:guid><purchaseProtocolPAAEData><guid>e8274477-52e7-4088-9b47-96ae26e93280</guid><createDateTime>2013-12-19T14:49:38</createDateTime><purchaseInfo><t:purchaseNoticeNumber>12345678902</t:purchaseNoticeNumber></purchaseInfo><placer><t:mainInfo><t:inn>3905088712</t:inn><t:kpp>390601001</t:kpp><t:ogrn>1083905000080</t:ogrn></t:mainInfo></placer><customer><t:mainInfo><t:inn>3905088712</t:inn><t:kpp>390601001</t:kpp><t:ogrn>1083905000080</t:ogrn></t:mainInfo></customer><auctionStartDate>2013-12-19T16:40:00</auctionStartDate><auctionEndDate>2013-12-19T16:43:50</auctionEndDate><protocolRZ1Requisites><t:registrationNumber>12345678901-12</t:registrationNumber><t:version>1</t:version></protocolRZ1Requisites><lotApplicationsList><protocolLotApplications><lot><guid>9f36d9bd-3d87-4894-814a-87d295e9a542</guid><ordinalNumber>1</ordinalNumber><subject>Предмет нефтяного договора</subject><initialSumInfo>123.00 руб.</initialSumInfo></lot><lotParameters><nonPrice>0</nonPrice></lotParameters><application><applicationNumber>1</applicationNumber></application><application><applicationNumber>2</applicationNumber></application></protocolLotApplications></lotApplicationsList></purchaseProtocolPAAEData></item></body> </purchaseProtocolPAAE>
----WebKitFormBoundaryp7MA4YWxkTrZu0gW
那么它的问题是什么?
P上。 S.没关系«Host»标题,我使用stunnel守护进程,所以我的数据用TLS传输。
答案 0 :(得分:0)