Forum Discussion
nmrao
Champion Level 3
May be you can try removing the existing attachment and attach the same again to see if that helps.
maddzy
8 years agoOccasional Contributor
Hi Rao,
Thanks for all your replies and suggestions. I think I have figured out a workaround for this issue. It's very hacky though.
I realised I can set the Request window to hold the entire message I want to send, including attachment data and boundaries. I can then set the Content Type" header manually (ie through a groovy script) to point to the same boundary that I already know is in the request.
So for example I set the request window as
--KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-ID: <ROOTPART> <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> //---- // SOAP Body XML Here //---- </SOAP-ENV:Body> </SOAP-ENV:Envelope> --KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: binary Content-ID: <8639147c-2e83-4209-91fa-320eb20a2fcf> //---- //Attachment data here (eg content of another XML file) //---- --KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5--
Then I set the Content-Type header as
multipart/related; boundary="KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5"; type="text/xml";start="<ROOTPART>"
And the request is sent with the MIME header information I want, and the attachments in the right place:
POST http://localhost:8280/ab/service/dri HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/related; boundary="KambGd0qv9bPTqokGRMcrgDlCZ7kvKx5"; type="text/xml";start="<ROOTPART>";charset=UTF-8 Content-Transfer-Encoding: binary Content-Length: 5763 Host: localhost:8280 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Not the most graceful way to do it, but it works for my use case.
Thanks again for your help Rao.
Regards,
Dave
Related Content
Recent Discussions
- 6 days agoemoya