-1
  • I am trying to upload XML file using multipart field along with the specified content Type as application/x-www-form-urlencoded but boundary getting appended in the request automatically and i am getting 415 unsupported media type in response:
Request:
1 > Accept: application/json
1 > Accept-Encoding: gzip,deflate
1 > Authorization: Bearer Pr3wkHwNDDfPh4Ik4IPLhGDcK1zt
1 > Connection: Keep-Alive
1 > Content-Length: 6739
1 > Content-Type: application/x-www-form-urlencoded; boundary=eeErrSgIwFHJn3_hjEi_-Q8_DHkKIo
1 > Host: api-sandbox.apiboitest.com
1 > User-Agent: Apache-HttpClient/4.5.9 (Java/1.8.0_144)
1 > client_id: jYXMYDGq0uTZee5peZpzwR
1 > client_secret: 
1 > request_method: POST
1 > x-fapi-financial-id: 1234
1 > x-idempotency-key: qwe3456
1 > x-jws-signature: qqqqq
--eeErrSgIwFHJn3_hjEi_-Q8_DHkKIo
Content-Disposition: form-data; name="myFile"
Content-Type: application/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
``````````````````````````````````````````````
and Code:
``````````````````````
  And multipart field myFile = read('classpath:path')
    And multipart field message = 'File'
    When method request_method
    Then status 200
``````````````````````

while in postman it works fine.

  • boundary is normal, this is part of the HTTP spec. try to search for other questions on stack overflow. try to provide a `cURL` export. or please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Jan 06 '20 at 18:55
  • Sorry for the delay. Here sharing cURL export as you have mentioned. Could you please help or explain in this as i am new to this. – Rupal Chavan Jan 21 '20 at 11:43
  • curl --location --request POST 'https://api-sandbox.boicloudtest.net/1/api/open-banking/v3.0/pisp/file-payment-consents/4a90e5cb-8450-4743-8cc9-d655d0d615d2/file' --header 'Content-Type: application/x-www-form-urlencoded' --header 'x-fapi-financial-id: 0015800000jfQ9aAAE' --header 'Authorization: Bearer W6' --header 'x-jws-signature: ey' --header 'x-idempotency-key: ghty66' --form 'FileParam=@/C:/Documents/FilePayments.xml' – Rupal Chavan Jan 21 '20 at 11:51
  • see answer, if this does not work, follow the link in my first comment – Peter Thomas Jan 21 '20 at 12:04

1 Answers1

0

This is my best guess. This is a url-encoded form NOT a file-upload. The rest is up to you:

* url 'http://api-sandbox.boicloudtest.net/1/api/open-banking/v3.0/pisp/file-payment-consents/4a90e5cb-8450-4743-8cc9-d655d0d615d2/file'
* header x-fapi-financial-id = '0015800000jfQ9aAAE'
* header x-jws-signature = 'ey'
* header x-idempotency-key = 'ghty66'
* form field FileParam = read('FilePayments.xml')
* method post
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248