Forum Discussion

dianes's avatar
12 years ago

soap with attachment

I was trying to attach an xml file to soap request, but got
"HTTP/1.1 415 Cannot process the message because the content type 'multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_8_16420037.1395957839375"' was not the expected type 'text/xml; charset=utf-8'."

The soap envelop looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:poc="http://www.abc.com">
<soapenv:Header/>
<soapenv:Body>
<poc:someoperation/>
</soapenv:Body>
</soapenv:Envelope>


The soap message with attachment looks like this:
POST /myService.svc HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_21_2644074.1395973827562"
SOAPAction: "http://www.abc.com/myService/someoperation"
MIME-Version: 1.0
Content-Length: 3564
Host: localhost
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


------=_Part_21_2644074.1395973827562
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart@soapui.org>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:poc="http://www.abc.com">
<soapenv:Header/>
<soapenv:Body>
<poc:someoperation>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_21_2644074.1395973827562
Content-Type: text/xml; charset=us-ascii; name=test.xml
Content-Transfer-Encoding: 7bit
Content-ID: <test.xml>
Content-Disposition: attachment; name="test.xml"; filename="test.xml"

<?xml version="1.0" encoding="utf-8"?>
<MovieList>
<Movie CT="A">
<MovielInfo CT="A">
</Movie>
<Moviel CT="A">
<MovieInfo CT="A">
</MovieInfo>
</Movie>
</MovieList>
------=_Part_21_2644074.1395973827562--

Anything wrong? Please advise. Thanks.
No RepliesBe the first to reply