Getting 403: Forbidden when consuming SOAP service using apache cxf in java -
while trying consume soap service using apache cxf 3.1.6 , java 8, changing payload content, getting either '200 ok' or '403 forbidden'.
the weird part is, if print out payload , put on soapui, 200 ok.
have encountered similar issue? how solve this?
so not stuck days me, scratching head , thinking why on heart happening, here issue explained , solution.
the issue happens because default apach cxf uses "chunking", sends small chunks of data endpoint, once defined threshold reached. results in soap messages being sent while not complete, resulting in '403' (assuming server not support 'chunking')! solution disable "chunking", changing spring-config.xml to:
<http-conf:conduit name="*.http-conduit"> <http-conf:client connection="keep-alive" maxretransmits="1" allowchunking="false" />
additional info:
on org.apache.cxf.transport.http.httpconduit, "prepare" method there bit explains all:
// delete not work , empty puts cause misleading exceptions // if chunking enabled // todo : ensure chunking can enabled non-empty puts - if requested if (cspolicy.isallowchunking() && ischunkingsupported(message, httprequestmethod)) { //todo: chunking mode configured or @ least // documented client constant. //use -1 , allow url connection pick default value ischunking = true; chunkthreshold = cspolicy.getchunkingthreshold(); } cookies.writetomessageheaders(message);
Comments
Post a Comment