I am calling a web service which expects some string data as multipart form input.
POST /add_or_update HTTP/1.1
User-Agent: Apache-HttpClient/4.3.3 (java 1.5)
Host: localhost:8011
Accept: */*
token:728-e087-ca01-08d34
Content-Length: 691
Expect: 100-continue
Content-Type: multipart/form-data; charset=ISO-8859-1
"--Kd2aTBM_weD045iHeEcrWPLhENlKkH_L6oBz"
"Content-Disposition : form-data; name="abc" "first""
"--Kd2aTBM_weD045iHeEcrWPLhENlKkH_L6oBz"
"Content-Disposition : form-data; name="type" "AD""
If I am using Apache HTTP client, the underlying service seems to throw an error.
Invalid boundary in multipart form ''
If I make this same request via CURL, it seems to work as expected. Here are the headers for it.
POST /add_or_update HTTP/1.1
User-Agent: curl/7.27.0
Host: localhost:8011
Accept: */*
token:728-001-ca01-08d34
Content-Length: 691
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------626b33b5dc95
The only difference I notice is that Apache HTTP client (4.2) does not use the boundary marker in the header but it still specifies the boundary in the payload, and I am guessing, that is causing the request to fail.
Has anyone been in a similar situation? Any pointers would be really appreciated. Thanks in advance.