How to sent a POST request with form-data and parameters in PL/SQL

后端 未结 2 1235
滥情空心
滥情空心 2020-12-21 12:13

I\'m trying to call REST WebService in PL/SQL but it doesn\'t work. I get this error:

Content-type must be multipart/form-data

2条回答
  •  清歌不尽
    2020-12-21 12:49

    I don't think you can use a POST with GET query like you do in the URL...

    It looks quite difficult to do what you expect. Here is some input from Ask Tom:

    The idea is to generate the post text, including a specific "boundary", which will look like this:

    POST /path/to/script.php HTTP/1.0
    Host: example.com
    Content-type: multipart/form-data, boundary=AaB03x
    Content-Length: $requestlen
    
    --AaB03x
    content-disposition: form-data; name="field1"
    
    $field1
    --AaB03x
    content-disposition: form-data; name="field2"
    
    $field2
    --AaB03x
    content-disposition: form-data; name="userfile"; filename="$filename"
    Content-Type: $mimetype
    Content-Transfer-Encoding: binary
    
    $binarydata
    --AaB03x--
    

    There is also same issue developed here with lots of code.

    Hope it helps.

提交回复
热议问题