How to use direct streaming for SOAP with Spring-WS?

主宰稳场 提交于 2019-12-03 01:56:18

You have also to disable the payload caching:

<bean id="messageFactory" 
      class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
     <property name="payloadCaching" value="false"/>
</bean> 

With this setting we are finally able to perform direct streaming for SOAP with Spring WS!

You cannot (should never) stream the data within a web service, as in continously sending XML over the HTTP connection in a single web-service request over time. You will have to make many single web-service calls, or accumulate several calls into one.

If you need high performance, web-services are not great. But you can hand-optimize simple web-services, it is not that hard. But switching to another transport format would be more 'on the money' if you need higher performance. I'd still keep things over HTTP - especially if you have some authentication requirements.

I can only think of a hack for this - stacks(cxf, spring ws etc) would buffer the entire message as they have to validate the response xml, to be able to calculate the cryptographic keys if security is enabled etc.

So the hack would be to write your own custom servlet/spring controller which would handle this specific response and stream out the soap envelope, then your payload, then the end tag of soap envelope. This is assuming you don't have any WSS requirements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!